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

Object with an empty string as key getting handled incorrectly #182

Open
tmladek opened this issue Jun 25, 2019 · 0 comments
Open

Object with an empty string as key getting handled incorrectly #182

tmladek opened this issue Jun 25, 2019 · 0 comments

Comments

@tmladek
Copy link

tmladek commented Jun 25, 2019

Consider this object:

{
  "foo": {
    "": {
      "bar": {
        "baz": 123
      }
    }
  }

The following path returns [123], as expected:

jmespath.search('foo."".bar.*', test)                                                                                                                                                                                                 
[123]

However, when I put a wildcard in place of the key which is an empty string, I don't get a result:

jmespath.search('foo.*.bar.*', test) is None                                                                                                                                                                                          
True

This is strange, because if I don't specify the second wildcard, the first one works and I do get a result:

jmespath.search('foo.*.bar', test)                                                                                                                                                                                                    
[{'baz': 123}]

I've asked on gitter and have been advised this might be a bug and not my misunderstanding of the JMESPath syntax.

I'm on JMESPath version 0.9.4, installed by pip on Python 3.

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

1 participant