What is the JSON Validator?
The JSON Validator checks whether a document is well-formed JSON and, when you supply a JSON Schema, whether it also conforms to that schema. The first check catches syntax mistakes; the second catches structural ones, such as a missing required field or a value of the wrong type.
There are two distinct questions you can ask about a JSON document. The first is whether it parses at all: whether the brackets balance, the strings are quoted correctly, and there are no stray commas. The second is whether the parsed data has the shape your application expects.
A document can pass the first check and fail the second. {"port": "5432"} is perfectly valid JSON, but if your schema says port must be an integer, it is still wrong for your purposes. This tool reports both classes of problem.
How to use the JSON Validator
- Paste the document to validate. Put your JSON into the input editor. Syntax validation runs against it immediately.
- Optionally supply a JSON Schema. If you want structural validation as well, paste a schema into the schema editor. Draft 7 and the 2019-09 and 2020-12 drafts are supported.
- Read the results. Syntax errors are reported with a line and column. Schema violations are reported per offending property, with the path to the value that failed and the constraint it broke.
- Fix and revalidate. Edit the input and the checks re-run, so you can work through a list of violations one at a time.
Worked examples
Validating against a schema
The schema below requires a name string and an integer age of at least zero. The document supplies age as a string, which is a type violation even though the JSON itself is well-formed.
// Schema
{
"type": "object",
"required": ["name", "age"],
"properties": {
"name": { "type": "string" },
"age": { "type": "integer", "minimum": 0 }
}
}
// Document
{ "name": "Grace Hopper", "age": "45" }Valid JSON syntax.
Schema validation failed:
/age: must be integer (got string)Changing "45" to 45 makes the document schema-valid.
Catching a missing required field
Required fields are a frequent source of runtime errors, because the absent value only surfaces when some later code dereferences it.
{ "name": "Katherine Johnson" }Valid JSON syntax.
Schema validation failed:
/: must have required property 'age'Common use cases
- Verifying API contracts. Paste a real response and the schema it is supposed to satisfy to confirm the server is honouring the contract before you write client code against it.
- Checking configuration before deployment. Many tools ship a JSON Schema for their config format. Validating locally catches a typo that would otherwise fail at service start.
- Developing a schema. When writing a schema, testing it against known-good and known-bad documents is the quickest way to confirm the constraints do what you intended.
- Reviewing third-party data. Before importing a data dump, validating it against an expected shape tells you whether the import will succeed without running it.
Features and limitations
- Reports syntax errors with line and column positions.
- Supports JSON Schema draft 7, 2019-09, and 2020-12.
- Lists every schema violation rather than stopping at the first one, so you can see the full extent of a problem.
- Identifies failures by JSON Pointer path, which makes nested violations unambiguous.
- Schema $ref resolution is limited to references within the supplied schema document. Remote references over HTTP are not fetched, since the tool makes no network requests.
- Custom format validators beyond the standard set are not supported.
Frequently asked questions
What is JSON Schema?
JSON Schema is a specification for describing the expected structure of a JSON document, which properties exist, what types they hold, which are required, and what value constraints apply. It is itself written in JSON.
Do I need a schema to use this tool?
No. Without a schema you still get syntax validation, which tells you whether the document is well-formed JSON. The schema is only needed for structural checks.
Why does valid JSON fail schema validation?
Because they test different things. Syntax validation asks whether the text is parseable; schema validation asks whether the parsed data matches your expected shape. A correctly-formatted document with a string where an integer belongs fails the second check.
Can it resolve external $ref URLs?
No. All references must be internal to the schema you paste, because the tool runs entirely in your browser and makes no outbound requests. Inline any external definitions before validating.
Is my data sent anywhere?
No. Both the document and the schema stay in your browser's memory. This matters when validating configuration that contains credentials or connection strings.
Which draft should I target?
Use whichever draft your tooling expects: the $schema keyword at the top of a schema declares it. 2020-12 is the most recent, but draft 7 remains very widely deployed and is a safe default if nothing else constrains you.
All processing happens locally in your browser, your data never leaves your device.
