Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Struggling with usage of Merge function #312

Open
ChaitanyaKandala opened this issue Jun 14, 2023 · 1 comment
Open

Struggling with usage of Merge function #312

ChaitanyaKandala opened this issue Jun 14, 2023 · 1 comment

Comments

@ChaitanyaKandala
Copy link

Hi,
I am trying to pass 2 dicts/arrays to the merge but I am not able to figure out how to do that. Can I get some help here please?
I tried various things but I can only get this to work.
print(jmespath.search('merge({"a":"b"}, {"a":"c", "b":"z"})', {}))

What do I do if I need to pass arguments? Like I have these 2 dictionaries.
one = {"a":"b"} two = {"a":"c", "b":"z"}
What am I missing?

@springcomp
Copy link

You cannot pass arguments to JMESPath currently, however, you could supply a single input JSON like so:
Given:

{
  "one": {"a": "b"},
  "two": {"a": "c", "b": "z"}
}

The following expression will do the merge for you:

  • merge(one, two)

Please, head over to the discussion ### chat for more reactive help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants