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

feat: add optional kw-arg 'filtered=True' in Name #41

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

linw1995
Copy link
Owner

It supports a new syntax like '$.goods[*].?category'.
Allow user to disable default behavior that filters the missing fields.

Fixes #40

This PR is still in development progress, please use it carefully.

❯ cat example.json 
{
    "goods": [
        {"price": 100, "category": "Comic book"},
        {"price": 200, "category": "magazine"},
        {"price": 200, "no category": ""}
    ],
    "targetCategory": "book"
}
❯ jp -f example.json '$.goods[*].?category'
[
  "Comic book",
  "magazine",
  null
]

@linw1995 linw1995 added the enhancement New feature or request label Jan 25, 2022
@linw1995 linw1995 self-assigned this Jan 25, 2022
@codecov
Copy link

codecov bot commented Jan 26, 2022

Codecov Report

Merging #41 (291b643) into master (3442ead) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #41   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            6         6           
  Lines          561       580   +19     
  Branches        75       107   +32     
=========================================
+ Hits           561       580   +19     
Impacted Files Coverage Δ
jsonpath/core.py 100.00% <100.00%> (ø)
jsonpath/transformer.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3442ead...291b643. Read the comment docs.

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

Successfully merging this pull request may close these issues.

Is it possible to get None when the value is not present in a specific array item?
1 participant