Mercurial > hg > config
view python/jsonex.py @ 504:c805a31fe0f5
http://www.emacswiki.org/emacs/GnuClient
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Sat, 31 Aug 2013 17:25:53 -0700 |
parents | cea81044578e |
children | e50a95358db3 |
line wrap: on
line source
#!/usr/bin/env python """ JSON explorer """ import json import sys from pprint import pprint def main(args=sys.argv[1:]): data = sys.stdin.read() # read from stdin obj = json.loads(data) if args: for arg in args: foo = arg.split('.') # split into objects # TODO: split into slice notation pass # TODO else: print json.dumps(obj, indent=2, sort_keys=True) if __name__ == '__main__': main()