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:
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.
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 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.
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:
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:
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.
During the development of JSONBuddy 4.5 we got a customer inquiry about the need to use spaces instead of tabs for indentation levels in the JSON editor. So we added this setting to the “Editor” page of the “Options” dialog:
If you remove the check from the “Use tabs for indentation” check-box, the editor will insert spaces to set the indentation level for every new line. This setting is also used for JSON pretty-print and the various conversion operations of JSONBuddy.
Please keep in mind that this doesn’t replace any tabs which are already inserted. Any existing JSON data with either spaces or tabs as indentation will keep the characters currently used. In addition, the indentation functionality copies the white-space characters from any previous line. So don’t be confused if any new line has still tab characters inserted because the previous line uses tabs as indentation. Any new document in the JSON editor will use the setting from above right from the start.
Ok, please don’t take this title literally. But did you know that you can instantly load all JSON schema files from schemastore.org in JSONBuddy? All you need to do is to open JSONBuddy and to use the “File | Open from JSON schema library…” command to show the open dialog which reads all available schema documents from schemastore.org. This list is updated any time you start the JSONBuddy editor.
schemastore.org is a great resource to learn how others are writing JSON schemas and can help a lot on providing own specifications for your JSON data. After the schema is loaded in JSONBuddy, the editor will automatically generate JSON sample data. You can immediately create a new document from the sample data using the “JSON | Generate sample document from JSON schema” command.