Skip to content

Releases: maztohir/dict-path

v1.1.1 - get array value easily

05 Oct 05:55

Choose a tag to compare

Now it's working with an array

Note: For now it's only working with get or extract_dict.
No plan yet for bringing this feature to set or inject_dict, since will conflict with the way of writing dict.
Any suggestion is still open.

from dict_path import extract_dict, DictPath

test_dict = {'foo1':{'foo2':[{'foo3':'bar'},{'foo4':[[{'foo5': 'bar'}]]}]}}
data = DictPath(test_dict)
data.get('foo1/foo2/1/foo4/0/0/foo5/')
#result: bar

extract_dict(test_dict, 'foo1/foo2/1/foo4/0/0/foo5/')
#result: bar