Skip to content

Commit 71dfbd1

Browse files
authored
Merge pull request kennknowles#31 from borysvorona/master
Added hook for catching null value instead of empty list in path
2 parents 9259184 + 3e36466 commit 71dfbd1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

jsonpath_ng/jsonpath.py

+3
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,9 @@ def __init__(self, start=None, end=None, step=None):
617617
def find(self, datum):
618618
datum = DatumInContext.wrap(datum)
619619

620+
# Used for catching null value instead of empty list in path
621+
if not datum.value:
622+
return []
620623
# Here's the hack. If it is a dictionary or some kind of constant,
621624
# put it in a single-element list
622625
if (isinstance(datum.value, dict) or isinstance(datum.value, six.integer_types) or isinstance(datum.value, six.string_types)):

0 commit comments

Comments
 (0)