Tales from support: JSON code folding

Someone who selected Recommend: yes and Overall quality: 1 on the survey form sent this additional feedback:

Code folding for JSON file does not work for situations like: "RaceCar": { "Domestic": true, "Model": [] }

Unfortunately, the user did not provide an email address, so a direct reply was not possible. What is the JSON editor doing with JSON data like this in terms of code folding? The sample data is all in one line. There is no chance for the editor to show code folding for JSON content that spans only a single line.

Use JSON pretty-print to show code folding

If you use JSONBuddy as your JSON editor, you also get a useful pretty-print function that can be executed by pressing Ctrl+Shift+P. The sample JSON is immediately formatted in the following way:

Formatting JSON with pretty-print in JSONBuddy

Formatting JSON with pretty-print in JSONBuddy.

As you can see, folding is available after the JSON data is formatted in the editor. It is also convenient that the current selection is preserved after the pretty-print operation is completed. Maybe a small but important detail to provide the best JSON editor experience possible.

Take a detailed look at some other features of JSONBuddy

JSONBuddy is more than just a JSON editor for Windows ®. Learn more on clicking the images and links below.