Skip to Content
ToDiagram

JSON Schema

Validate a document against a JSON Schema, generate a schema from your data, and create mock data from a schema.

A JSON Schema describes what a document should look like: which fields it has, their types and which ones are required. Attach one to a document and the editor checks the document against it as you type.

JSON Schema is available for JSON, JSON Lines, YAML, CSV and XML documents. It is not available for Mermaid and ToDiagram documents.

The JSON Schema dialog with a schema generated from the open document

Attach a schema

  1. Click JSON Schema in the bar under the text editor.
  2. Paste your schema, or click the first button under the editor to generate a schema from the current data.
  3. Click Apply Schema.

When the document does not match the schema, the JSON Schema button turns yellow with a warning sign. Hover it to read what is wrong.

To stop validating, open the dialog again and click Disable.

Tools in the dialog

The three buttons under the schema editor, from left to right:

ButtonWhat it does
Generate schema from current dataWrites a schema that matches the open document. A good starting point to edit by hand
Generate mock data from schemaOpens a new JSON tab filled with sample data that follows the schema
Resolve $ref referencesReplaces every $ref in the schema with the definition it points to

JSON Lines

A schema attached to a JSON Lines document describes one record, and every line is checked against it. See JSONL.

Saved with the document

The schema is part of the document. When you save the document to the cloud, the schema is saved with it.

On this page