How to View Large JSON Files on Windows

Let’s say you need to view a huge (more than 1 GB) JSON file. Of course you are not going to view so much data, it’s humanly impossible. What you want to do is to get a general understanding of JSON structure.

I assume that JSON document is already properly formatted.

First of all we will copy first 10,000 lines to a new file. We will user PowerShell for that:

Get-Content large.json -TotalCount 10000 | Out-File truncated.json

Next, open truncated.json in Sublime Text Editor and scroll to the end:
sublime-truncated-json

The JSON is not valid right now. Let’s make it valid by closing all ‘[‘ and ‘{‘ brackets. Sublime Text has a great feature that highlights invalid JSON code:
sublime-invalid-json-highlighted

All you need to do is to try to add brackets alternating between ‘[‘ and ‘{‘ until you reach the first column:
sublime-valid-json

Now you can save the file and open it in JSON Viewer. Since the new file is small you should have no problems viewing it as tree:
json-viewer

By the way, I’m thinking of building a tool that would automate this process – leave a comment if you’re interested in learning more.

Published by Pavel Chuchuva

I help coaches to deliver group programs.

Leave a comment

Your email address will not be published. Required fields are marked *