jmespath / jmespath/jmespath.py

Differentiate between missing values and null values

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

Description

I'm trying to do a search like:

```python
from jmespath import search
data = {
"grid": [
{"col1": "a", "col2": None},
{"col1": "b", "col2": None},
{"col1": "c", "col2": "x"},
{"col1": "d", "col2": "y"},
]
}
col1_data = search("grid[*].col1", data) # gets ["a", "b", "c", "d"]
col2_data = search("grid[*].col2", data) # gets ["x", "y"], expecting [None, None, "x", "y"]
```

If the `col2` element did not exist, I think the current behavior makes sense. However, I think that `search` by default shouldn't also do filtering.

For reference:
https://github.com/jmespath/jmespath.py/blob/599b0f7ea650a60f7512233301e70ff8151de0f0/jmespath/visitor.py#L134-L138
https://github.com/jmespath/jmespath.py/blob/599b0f7ea650a60f7512233301e70ff8151de0f0/jmespath/visitor.py#L279-L280

Thoughts ?

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.