JSON is a popular text format to store information that is both structured and lightweight. Because JSON is just text, you can keep it in a single line or long text field. The JSON editor block makes it easier to work with JSON by formatting the contents of the field with colored syntax, indenting, and warnings for malformed JSON.
You can install the JSON editor block from the blocks gallery.
Once installed, you will be prompted to select a cell in your grid view (single line text or long text field). No additional configuration is needed.
Editing your JSON
As soon as you select a cell for a single line or long text field, you can start typing in the block to add or change the JSON contents. As you type, the following can help you understand and organize your information.
- Color syntax highlighting: JSON is made up of key-value pairs that are separated by a colon. The key is red-orange, and the value is blue or green depending on if it is text or a number.
- Collapsible groups and indenting: When the JSON data has parentheses, square braces, or curly braces, the contents with those will be indented to make the nested grouping clearer. You can collapse the group by clicking the down arrow that appears when you move your mouse to the left of the editor pane.
- Warnings for malformed JSON: As you type, a message at the bottom will warn you when the text is not valid JSON. The error will also be highlighted with a red squiggle underline.
The most common available shortcuts are available by right-clicking in the editor pane. To view all the shortcut commands, select "Command Palette" at the bottom of the menu.