Pretty Print JSON
echo '{"foo": "lorem", "bar": "ipsum"}' | python -mjson.tool
Dump Django data as pretty JSON
./manage.py dumpdata mymodule | python -mjson.tool
Prety Print JSON from Python Shell
import json
json_data = [1,2,3,{'a','b',c'}]
json.dumps(json_data, sort_keys=True, indent=4)
http://stackoverflow.com/questions/352098/how-to-pretty-print-json-script
http://docs.python.org/library/json.html
Subscribe to:
Post Comments (Atom)
1 comment:
Thank the heavens for the snippet. +1
Post a Comment