Compact but pretty JSON output in python? -


json written either indent=none (default) single line (unreadable human eye) or ident=n newline after each comma.

what see more compact still pretty output, similar common lisp pretty-printing does. e.g., instead of

 {   "cleanup":{    "cpu":6936.780000000001,    "wall":7822.319401979446   },   "finished":"2017-08-14 18:36:23",   "init":{    "cpu":1365.73,    "wall":1380.7802910804749   },   "job":"timings",   "run":{    "cpu":953.6700000000001,    "wall":8350.496850013733   },   "started":"2017-08-14 13:28:06"  } 

i see

 {   "cleanup":{"cpu":6936.780000000001,"wall":7822.319401979446},   "finished":"2017-08-14 18:36:23",   "init":{"cpu":1365.73,"wall":1380.7802910804749},   "job":"timings",   "run":{"cpu":953.6700000000001,"wall":8350.496850013733},   "started":"2017-08-14 13:28:06"  } 

similar pprint produces.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -