JSON: Difference between revisions
From charlesreid1
(Created page with "to print out pretty json using Python: <pre> d = dict(a=1,b=2,c=3) with open('pretty.json','w') as f: json.dump(d, f, separators=(',',': '),indent=4) </pre>") |
No edit summary |
||
| Line 6: | Line 6: | ||
json.dump(d, f, separators=(',',': '),indent=4) | json.dump(d, f, separators=(',',': '),indent=4) | ||
</pre> | </pre> | ||
[[Category:Json]] | |||
[[Category:Python]] | |||
Revision as of 08:44, 21 February 2018
to print out pretty json using Python:
d = dict(a=1,b=2,c=3)
with open('pretty.json','w') as f:
json.dump(d, f, separators=(',',': '),indent=4)