Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/env python
import json
import sys
def pp(vv, prefix='$'):
if isinstance(vv, (list,tuple)):
for i, v in enumerate(vv):
pp(v, "{0}[{1}]".format(prefix, i))
elif isinstance(vv, dict):
for k,v in sorted(vv.items()):
pp(v, "{0}.{1}".format(prefix, k))
else:
print '{0} = {1}'.format(prefix, json.dumps(vv))
pp(json.load(sys.stdin))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.