Deep Path StringsΒΆ
A deep path string is used to access a nested data structure of arbitrary length. Each level is separated by a "." and can be used on both dictionaries and lists. If a "." is contained in one of the dictionary keys, then it can be escaped using "\". For accessing a dictionary key that is a number, it can be wrapped in brackets like "[1]".
Examples:
>>> data = {'a': {'b': {'c': [0, 0, {'d': [0, {1: 2}]}]}}}
>>> pydash.deep_get(data, 'a.b.c.2.d.1.[1]')
2
>>> data = {'a': {'b.c.d': 2}}
>>> pydash.deep_get(data, r'a.b\.c\.d')
2
Functions that support deep path strings include:
pydash.collections.deep_pluck()pydash.objects.deep_get()pydash.objects.deep_has()pydash.objects.deep_set()pydash.utilities.deep_property()/pydash.utilities.deep_prop()
Pydash’s callback system also supports the deep property style callback using deep path strings.