User guide
×
Menu

JSON Schema editor

 
In order to help people writing JSON schemas, JSONBuddy provides special syntax-coloring and auto-completion for schema keywords together with a built-in validator.
To tell the editor that you are working on a JSON schema, simply use the "Quick Associations" pane and set the "Current document is a JSON Schema" checkmark. From this moment on the editor knows that this JSON document should be treated as JSON schema:
 
 
You will notice that the way JSON syntax-coloring works changes immediately after telling the editor that the current JSON content is actually a schema. All of the schema keywords are now green and all of the keywords are also present in the auto-completion. The picture below shows how the library JSON schema sample, which is also part of the installation, is displayed afterwards in the editor. JSON Schema keywords like "properties" or "description" appear in green, while arbitrary names like "bib" are still in red. This improves the readability of the schema in the editor a lot and helps on editing the document:
 
 
Auto-completion is also a very important feature and helps tremendously on creating and editing any text-based standard. As you can see on the previous screenshot, the editor provides a list of JSON schema keywords also for the entry-helper popup.
 
JSON schema specification text in Schema info window
 
 
The full JSON schema specification text is shown as interactive help text in the Schema info window while the current selection is at a schema keyword.
 
Validation of JSON Schema files
 
To validate JSON Schema documents the editor provides a built-in schema for schemas. If the current document is marked as JSON schema the "Validate against JSON Schema" command will use the built-in schema to detect errors in the active schema. This makes it easy to create error free JSON schemas in less time. The sample has been modified in a way that the built-in JSON schema validator reports an error. As you can see on the screenshot the "required" keyword array contains a wrong value type. The editor will point you to the error location in the schema and also shows the exact description in the "Results" pane at the bottom. You can jump to the error position at any time on clicking the entry in the Results window:
 
 
Preview of generated sample data
 
The text Preview is filled with the generated JSON sample data from the current JSON schema. This sample data is updated while you are editing the schema.
 
Quickly test JSON instance files while editing the schema
 
To check a JSON document against any JSON Schema, enter the path to the JSON schema at the "JSON Schema" field of the "Quick Associations" pane when the JSON instance is the active document. Now the editor keeps a reference to the schema for this instance document. It is also possible to put a relative path here. If both documents are located in the same folder just enter the name of the schema here. Whenever you use the "Validate against JSON Schema" command the schema content is either loaded from disk or directly taken from the editor and the validation results appear in the "Results" pane. This makes it possible to quickly test the schema while it is still open in JSONBuddy for editing.
 
In addition, the background validation also shows any errors as indicators in the text view. The error message is shown when you move the mouse over the property in the JSON instance. This happens while you are editing your JSON schema and your JSON data side-by-side:
 
 
Most of the reported errors also contain the location as JSON pointer. Simply click on the error in the Results window to use the jump-to-error functionality and to go to the position where the error was detected in the JSON content by the JSON validator.
 
Quickly create a sample document from a JSON schema
 
Use the "Generate sample document from JSON schema" command to create a new JSON document directly from the generated sample data based on the current JSON schema. If the JSON schema is already saved to disk and has a file path, the JSON schema is also assigned automatically to the new JSON instance document (the path is added to the "Quick Associations" settings). This command is only enabled for JSON schemas.