by smizell · 10y ago · 0 comments
In JavaScript, a simple thing that helps is to use lodash.get and provide a path to the property you are wanting.
lodash.get(someObject, 'path.to.a.property')
If the path isn't there, the lodash.get returns undefined. This is much nicer than getting the error "Cannot read property 'to' of undefined" when "path" isn't there.https://pypi.python.org/pypi/jsane
>>> j = jsane.loads('{"foo": {"bar": {"baz": ["well", "hello", "there"]}}}')
>>> j.foo.bar.baz[1].r()
u'hello'