-
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
import jsonpath_rfc9535 as jsonpath
data = { 'foo':{ 'bar': { 'baz': 42 } } }
node = jsonpath.find_one('$.foo.bar.baz', data)
print(node.value)# --> 42
print(data['foo']['bar']['baz'])# --> 42
node.value = 99
print(node.value)# --> 99
print(data['foo']['bar']['baz'])# Wish that it were 99
Reading values is pleasantly simple. It would be great if writing values could be just as easy. Ideally, one could simply write
node.value = 99
This would then update both "node.value" and "data['foo']['bar']['baz']" with the new value. Other syntax options would also be acceptable. Another useful addition would be "node.parent", allowing for calls like
node.parent['baz']
to be used. I prefer "jsonpath_rfc9535" because of its good syntax compatibility with the JSONpath standard.
Thank you for your helpful work.
jg-rp
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request