from jsonpath_ng import parse
selector = '$.*.number'
data = {
'foo': ['abc', 'def'],
'bar': {'number': 123456},
'boolean': True
}
val = '98765'
expr = parse(selector)
expr.update(data, val)
Expected
'number' field to be updated to '98765'.
Observed
File "/home/andrew/test.py", line 12, in <module>
expr.update(data, val)
File "/home/andrew/jsonpath_ng/jsonpath.py", line 261, in update
self.right.update(datum.value, val)
File "/home/andrew/jsonpath_ng/jsonpath.py", line 526, in update
if field in data:
TypeError: argument of type 'bool' is not iterable
Related to https://github.com/h2non/jsonpath-ng/issues/47
Steps to reproduce:
Expected
'number'
field to be updated to'98765'
.Observed