JSON Schema Validator
Validate JSON against a JSON Schema 2020-12 with the validator and settings Salyro uses — every violation by its path, highlighted in your text.
What it does
Paste a JSON Schema and a JSON value — a model's answer, as it came back — and see whether the value matches. Every violation is listed by its JSON path with a sentence that says what is wrong, and Show in JSON selects the value in your text. Everything runs in your browser: nothing you paste is sent anywhere.
The schema can be on its own, inside a response format (OpenAI's response_format, Anthropic's output_config.format) or inside a tool definition, as in the compatibility checker.
The same validator Salyro uses
A Salyro Behavior with a structured Output Contract validates every answer against its schema before returning it. This tool uses the same validator — Ajv, for JSON Schema 2020-12 — with the same settings, so its verdict is the one Salyro reaches. A parity test runs Salyro's own validation code over a shared set of schemas and answers and requires the same result, the same sentence and the same path.
The result also says what Salyro would answer for this text: accepted, or refused as behavior_output_invalid with the first violation's sentence and path. Salyro reports only the first violation; the tool lists all of them.
The settings, and what follows from them:
- No type coercion.
"12"is not12, and"true"is nottrue. - Not strict about keywords. A keyword the validator does not know is ignored, not an error, so a schema carrying another tool's annotations still compiles.
- Formats are not checked. No format vocabulary is loaded, so
"format": "email"accepts any string. The tool lists every format it did not check. - The text must be JSON as sent. A comment or a trailing comma makes the whole answer not JSON to Salyro. The tool still lists the violations of the value as if they were removed, and says Salyro would refuse it.
What it does not know
- Whether a provider enforces the schema. This checks an answer after it arrives. Whether the provider constrains its output to the schema is the compatibility checker's question.
- Formats. See above: not checked here, and not by Salyro.
- A
$refto another document. It is not fetched. A schema that needs one does not compile, and Salyro refuses it the same way. - A property named
__proto__. The validator never counts it as a listed property, which Salyro inherits.
FAQ
Why does my schema not compile?
The validator reads JSON Schema 2020-12 only. A schema that declares another draft in $schema, uses a keyword with a value the specification does not allow, or has a pattern that is not a regular expression is refused, with the validator's reason. Salyro refuses the same schema as an Output Contract.
What counts as a schema?
Any JSON object, bare or inside a response format or tool definition. {"minimum": 0} and {"required": ["id"]} are schemas, and {} accepts every value. An object with no JSON Schema keyword at all also accepts every value, in Salyro too, and the tool says so, since it is often a value pasted in the wrong box. true and false are schemas in JSON Schema 2020-12, but an Output Contract's schema is an object, so the tool asks for {} or {"not": {}} instead.
Why does it say Salyro accepts an answer it lists a violation for?
The verdict is the one Salyro's engine reaches, which stops at the first violation. Listing every violation is a second check by the same validator, and for a few rare combinations of keywords, such as prefixItems with contains on an empty list, the two do not agree. When that happens the tool says so, and the verdict shown is the engine's, because that is what Salyro enforces. If the validator runs out of stack on a schema in your browser, the tool says that too, rather than giving a verdict.
Why is a string length counted differently from my editor?
Lengths are counted in Unicode code points, as the specification says. An emoji is one character, even where JavaScript counts two.
Can a schema freeze the page?
No. Validation runs in a Web Worker and is stopped after ten seconds, so a pattern that backtracks for ever ends with a message instead.
Sources
The rules are the JSON Schema 2020-12 specification, as the Ajv validator implements it. The settings are Salyro's own, shared with the engine's code rather than copied from it.
Where the numbers come from
This tool works only on what you enter. It uses no external data and runs entirely in your browser.
