I recently had to explore a JSON API and came up with the following twothree functions to make working with the returned JSON/dict easier:
[Update 2015-11-10: you might like dripper, which does much of this code snippet…]
[Update 2015-09-26: updates to code and new convert_to_dataframe_input function: see here for a post about it]
_null = object() def get_from_structure(data, name, default=_null): """Return the element with the given name. `data` is a structure containing lists, dicts or scalar values.