sileht / python-jsonpath-rw-ext

Extensions for JSONPath RW
Apache License 2.0
59 stars 19 forks source link

None value proplem #24

Closed dgusakov closed 5 years ago

dgusakov commented 5 years ago

I'm trying to use jsonpath like $[?(@.payId == 154)] to extract element from json [ { "payId":154, "amount":100 }, { "payId":155, "amount":150 }, { "payId":null, "amount":500 } ] but I get File "/usr/local/lib/python3.6/site-packages/jsonpath_rw_ext/_filter.py", line 80, in find value = int(value) since python can not convert None to int

Possible solution for this problem is to add None value check before type conversion section in _filter.py This method worked for me (my fork).

dgusakov commented 5 years ago

Fixed by https://github.com/sileht/python-jsonpath-rw-ext/commit/a67fed3f0cb41077d7add1f26fbf05ab3f447961