jmespath / jmespath/jmespath.py

Object with an empty string as key getting handled incorrectly

Open
#182 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
2.4k
Forks
212
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.