I have json paths from the results of search. I'm wondering how do I write to the particular path?
doc = {'foo':{ 'cd': {'baz': 1}, 'cd2': {'baz': 2}}}
expression = "foo.*.baz"
jsonpath_expr = parse(expression)
values = [str(match.full_path) for match in jsonpath_expr.find(doc)]
>> [foo.cd.baz, foo.cd2.baz]
for each of these results i want to insert a doc in its deep leaf like these
{'foo':{ 'cd': {'baz': 1, 'baz2': 2}, 'cd2': {'baz': 2, 'baz2': 2}}}
How do i go about these? I don't find any source of writing a value to a document given a json path. Thank you for the help.