jsondata-processing

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


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?


Solution

  • With python >= 2.6 you can do the following:

    For Mac/Linux users:

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

    For Windows users (thanks to the comment from dnk.nitro):

    type ugly.json | python -m json.tool > pretty.json