Open
Description
Hi,
I would like to know if there is an option to set multiple values, like I can get multiple values.
For example:
import dpath.util
simple_json = {"a": [{"1": "b"}, {"1": "c"}]}
extracted_list = dpath.util.values(simple_json,"a/*/1")
print(extracted_list)
# ['b', 'c']
new_list = ["d","e"]
extracted_list = dpath.util.set(simple_json,"a/*/1",new_list)
print(simple_json)
# {"a": [{"1": "d"}, {"1": "e"}]}
Activity
moomoohk commentedon Sep 6, 2021
Hey Ariel,
There doesn't appear to be a built in way to do this at the moment.
I'm still getting familiar with the code, once I'm done I'll consider adding this feature.
A pull request will also be more than welcome :)
שנה טובה!