Skip to content

Instantly share code, notes, and snippets.

@abi
Created June 21, 2011 22:14

Revisions

  1. abi revised this gist Jun 21, 2011. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions json-prettyprint.py
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    #Usage: py thisfile.py {JSON-string}
    #Try py thisfile.py "["foo", {"bar":["baz", null, 1.0, 2]}]"

    import json
    import sys
  2. abi created this gist Jun 21, 2011.
    8 changes: 8 additions & 0 deletions json-prettyprint.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    #Usage: py thisfile.py {JSON-string}

    import json
    import sys

    if __name__ == "__main__":
    obj = json.loads(sys.argv[1])
    print json.dumps(obj, sort_keys=True, indent=4)