Closed josephwhite13 closed 4 years ago
When filtering a dictionary, we can apply the filter on dictionary.values().
>>> from jsonpath_ng import jsonpath >>> from jsonpath_ng.ext import parse >>> simple_dict = { "phone_numbers": { "1":{ "type" : "iPhone", "number": "0123-4567-8888" }, "2":{ "type" : "home", "number": "0123-4567-8910" }, "3":{ "type" : "home", "number": "1098-7654-3210" } } } >>> expression = parse('$.phone_numbers[?(@.type == "home")]') >>> print([x.value for x in expression.find(simple_dict)]) [{'type': 'home', 'number': '0123-4567-8910'}, {'type': 'home', 'number': '1098-7654-3210'}]
This should resolve #16 and resolve #19. If there is any additional info I need to provide, feel free to reach out!
Coverage remained the same at 0.0% when pulling c7d8b7581fbfd8c58656f0e956fd8afeb3fc5e79 on josephwhite13:allow-dictionary-filtering into e5405c1adc9b90aa081595d4982833f6f2a2893a on h2non:master.
Hello @h2non, do you know if and when this pull request could be merged? Thanks
@h2non Will this be pushed into pypi as 1.5.2? Thanks
Great. Thanks 👍
v1.5.2 is out on PyPI. Apologies for the delay!
v1.5.2
When filtering a dictionary, we can apply the filter on dictionary.values().
This should resolve #16 and resolve #19. If there is any additional info I need to provide, feel free to reach out!