Tales from support: Picking the right editor view for large JSON data

A user sent me an inquiry about opening large JSON data in JSONBuddy. This can be indeed a little bit tricky if the default view for JSON data is set to the Grid view in the editor settings. Not all data is suitable to be displayed in the Grid view. JSON with a lot of child properties at the same parent could take a lot of processing time and memory if you want to show the JSON as Grid in the editor. So the user wanted to get some help:

I don’t believe this is a fault in your software, as all other editors seem to be overwhelmed by the 450,000 rows as well… I was just curious if you had any tips that may help improve the performance of this application…. As without better performance, I cannot justify purchasing a license.

And I replied:

450,000 rows in total is not that much as I’m frequently working with files with several millions of lines. I recommend to use the text view modes of JSONBuddy (and XML ValidatorBuddy) if you are working with really large files. Using the text view, the editor supports two modes. The standard view which loads all of the file content and the Large File view which always only keeps parts of the content in memory.

Set the default view to text for large data

As a first step set the text view as the default view for your large (JSON, XML or any text format) data. Please learn more about this here.

Set a limit in MB for the Large File text view in the editor

How can you set the limit for the Large File view? There is a setting in the Options dialog on the Editor page which sets the limit in megabytes for using the standard view:

Option to set the limit for the Large File view
Option to set the limit for the Large File view

Any file larger than the limit will be loaded in the Large File view. Using the Large File view it is no problem to browse files even with a size of several GBs. Please note that you would need a plus license of XML ValidatorBuddy (a Plus version of JSONBuddy with support for large file editing will be available in the near future) if you want to edit the file. In general, avoid the Grid view for large data and use the Large File view in the text editor.

Pretty-print and remove whitespace for large JSON data

What do you do if you need to compact a JSON document but the file has more than 400 MB and 20 Million lines? Or the other way around, you have a large document and it is impossible to read because it has no formatting? So you need a JSON editor which can do two things for you. The editor can open and view really large text files and it needs to know how to format or compact your JSON data. Luckily, JSONBuddy can do both for you.

Select your large JSON data

Simply select your large JSON document in the built-in File Explorer window. This is important to avoid loading the file into the editor and to keep a constant memory footprint for really huge JSON documents. You can also select multiple files if you need to do this for several documents:

Remove whitespace from big JSON data
Remove whitespace from big JSON data

Remove whitespace from your large JSON documents

Run either the “Pretty-print JSON” or “Remove whitespace from JSON” command from the JSON menu. JSONBuddy will save the output document next to the original JSON with a new file name. You will still have the original content as before on your disk.

Of course, you can also run both commands on the current document in the JSON editor.

Instant validation while editing JSON data

Are you tired of clicking the “Validate” button or pressing F11 every time you want to know if your JSON data has still some validation errors? Then there is the good news. With JSONBuddy 4.5 you don’t need to run the JSON validator explicitly anymore while you are working on your JSON data in the editor. Instead, you always get all issues displayed as text indicators instantaneously and directly in the JSON editor. You also get the error message shown as call-tip if you hover with the mouse over the indicator for a short while:

JSON validator runs in the background in the editor
JSON validator runs in the background in the editor

Instant validation at any time

This allows a new way of working with JSON documents in JSONBuddy. You just open the JSON and if there is already a schema assigned, you can immediately see if the JSON data has errors or not. And to make it easier to fix any issues and to know what values are actually available for the enumeration, the editor will also display an entry-helper if you are going to fill the property:

Enum values from the assigned JSON schema
Enum values from the assigned JSON schema

So in summary, you always see any errors immediately and you get instant help if you want to fix them in the editor while you are editing your JSON data. Both make working with JSON more convenient and help to save time. Two important things to provide the best JSON editor experience possible.