Use this script on a json file and observe all the trailing spaces generated. (screenshot attached.)
#!/usr/bin/env python
"""
Pretty print json file.
"""
if __name__ == '__main__':
import sys
import json
if '-h' in sys.argv or '--help' in sys.argv:
print "Usage: ppjson <FILE>"
exit(0)
assert sys.argv[1], "No file provided"
with open(sys.argv[1]) as f:
print json.dumps(json.load(f), indent=4)
<<attachment: py-json-bug.png>>
_______________________________________________ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
