Live data from Hacker News

Ask HN: How do you view large JSON files?

news.ycombinator.com

21–30 of 60 posts

Re: Ask HN: How do you view large JSON files?

#25
post #3

There's addons/extension for Chrome and Firefox. Both also called JSON Viewer (different author). For really large files I use a command-line tool plus grep and awk though https://stedolan.github.io/jq/

jq looks promising but I still need to view the JSON file first. I want to be able to somehow get the general understanding of the structure very quickly and interactively. The tree control works very well for that. JSON Viewer is almost perfect but it doesn't work with local files.

JSON Formatter for Chrome works with local files (you have to check the box in the settings to enable it).

It's super handy. Drag and drop json files into a new tab.

Link: https://chrome.google.com/webstore/detail/json-formatter/bcj...

Re: Ask HN: How do you view large JSON files?

#26

If you're familiar with vim, you can do this cat unformatted.json | python -mjson.tool | vim - And then use vim's folding methods to navigate the file ( http://vim.wikia.com/wiki/Folding )

I use json.tool a lot too, but usually pipe it to `less`, using the paging and searching.

Re: Ask HN: How do you view large JSON files?

#27
post #3

There's addons/extension for Chrome and Firefox. Both also called JSON Viewer (different author). For really large files I use a command-line tool plus grep and awk though https://stedolan.github.io/jq/

jq looks promising but I still need to view the JSON file first. I want to be able to somehow get the general understanding of the structure very quickly and interactively. The tree control works very well for that. JSON Viewer is almost perfect but it doesn't work with local files.

I usually use jq to understand the structure of the file. `keys` will get you all the key names in an object; `with_entries(.value |= type)` will replace each element on an object with its type. You can quickly delve into a JSON and gain some understanding of it with jq.

Re: Ask HN: How do you view large JSON files?

#29

I view them unfavorably.

I personally think that's one of the more sane replies.

It is really important to chop up your JSON files into smaller sub-files. This will not only make it easier to backup and read manually but will usually give you a speed boost (can read to and write to more then 1 part of the "db" at a time).

Post reply on HN