Validate

Check a document against a JSON Schema, with errors you can click.

Validate against a schema

Open the Schema panel in the sidebar and paste a JSON Schema. Pandia validates the document live as you edit either side. It supports both draft-07 and 2020-12, read from the schema's $schema declaration.

Load a schema automatically

Pandia fills the Schema panel for you when a schema is named in one of two places:

  • The command line, as pandia config.json --schema ./config.schema.json. The schema can be a path or an https:// URL. A relative path is read from the folder you ran the command in. See Command line to install pandia.
  • The document, as a top-level "$schema": "./config.schema.json". A relative path is read from the document's folder.

If both are set, --schema wins, and the Schema panel shows which document reference it replaced. A schema that can't be loaded shows an error, and Pandia never falls back to the other one.

Local schema files load straight away. When a document's $schema is a URL, Pandia asks before downloading it, so opening a file never contacts a server on its own. Remote schemas must use https:// unless you turn on Settings → Behavior → schemas over http. A $schema that names a JSON Schema version on json-schema.org means the file is itself a schema, so nothing is loaded.

If your schema sets additionalProperties: false, the document's own $schema key fails validation. Add "$schema": { "type": "string" } to the schema's properties to allow it. Pandia shows this hint when it happens.

A schema that uses $ref to point at other files can't load them yet.

Clickable errors

Each error shows the failing path and the reason it failed. Click an error to jump straight to that node in the document. The status bar shows the running error count, so you always know how many issues remain.

Example

A tiny schema requiring an integer id and a string name:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "required": ["id", "name"],
  "properties": {
    "id": { "type": "integer" },
    "name": { "type": "string" }
  }
}

Validated against this document:

{
  "id": "42"
}

Pandia reports two errors:

/id    "42" is not of type "integer"
$      "name" is a required property

Click either error to land on the offending node.

Generate a schema, too

Pandia can also generate a JSON Schema from a document — see Type generation.

Related — the JSON Schema validator.