Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to see a large JSON file pretty printed on Ubuntu? [closed]

I would like to hear your suggestions on how to handle a large (40MB) JSON file on Ubuntu. I would like to see it pretty printed in vim or gedit or any other editor. One can find numerious tutorials on how to prettify the JSON, however, they do not have to deal with large input. I also imagine I could pipe the data through pygments or any other syntax highlighter. I am curious to hearing your ideas.

Example download:

wget -O large-dataset.json http://data.wien.gv.at/daten/wfs?service=WFS&request=GetFeature&version=1.1.0&typeName=ogdwien:BAUMOGD&srsName=EPSG:4326&outputFormat=json 

Please mind the download size!


EDIT: I found out that meld is working somewhat. The application does not load the whole file at once which would block the user interface. Instead it sequentially reads the file content.

like image 508
JJD Avatar asked May 22 '12 14:05

JJD


People also ask

How do I view a JSON file in Ubuntu?

It can be accessed directly from the Command Palette (Ctrl[Cmd]+Shift+P ) where you can search for JSON minify or prettify. You can go Ctrl[Cmd]+Alt+P to directly prettify the selected text or and Alt+M to minify it.

How do I view a JSON file in Linux?

Vim is a file opener software that can be used to open the JSON file on Linux platform. GitHub Atom is a cross-platform tool to open JSON files. Other than these tools, you can use web browsers like Google Chrome and Mozilla Firefox to open JSON files, which we discuss in detail later.


1 Answers

Python JSON's module can do this too (python -m json.tool), e.g.:

cat myjsonfile.json | python -m json.tool > pretty.json 
like image 96
gertvdijk Avatar answered Oct 07 '22 12:10

gertvdijk