Open

Description
>>> data = {}
>>> set_pointer(data, "/cat/name", "whiskers")
Traceback (most recent call last):
File "......./jsonpointer.py", line 276, in walk
return doc[part]
KeyError: 'cat'
During handling of the above exception, another exception occurred:
..........
raise JsonPointerException("member '%s' not found in %s" % (part, doc))
jsonpointer.JsonPointerException: member 'cat' not found in {}
Could there be an option (off by default) to create dicts/lists as it tries to set things? So instead you'd get:
>>> data = {}
>>> set_pointer(data, "/cat/name", "whiskers", option=True)
{'cat': {'name': 'whiskers'}}
I started hacking on something at https://github.com/stefankoegl/python-json-pointer/compare/master...odscjames:set-create-structures?expand=1
More needs to be done on that, but if I can get something to work is this something your interested in?
I can see there might always be some edge cases around things like creating lists, and I don't think that could be fixed but it might still be useful?
Metadata
Metadata
Assignees
Labels
No labels