json-path-expression

Xpath like query for nested python dictionaries

Xpath like query for nested python dictionaries Question: Is there a way to define a XPath type query for nested python dictionaries. Something like this: foo = { ‘spam’:’eggs’, ‘morefoo’: { ‘bar’:’soap’, ‘morebar’: {‘bacon’ : ‘foobar’} } } print( foo.select(“/morefoo/morebar”) ) >> {‘bacon’ : ‘foobar’} I also needed to select nested lists 😉 This can …

Total answers: 11