Best way to format large JSON file? (~30 mb)

covariance picture covariance · Nov 9, 2013 · Viewed 9.7k times · Source

I need to format a large JSON file for readability, but every resource I've found (mostly online) doesn't deal with data say, above 1-2 MB. I need to format about 30 MB. Is there any way to do this, or any way to code something to do this?

Answer

pstadler picture pstadler · Nov 9, 2013

With python >= 2.6 you can do the following:

cat ugly.json | python -mjson.tool > pretty.json