JSON Validator

Paste JSON and get a verdict. When it is valid you get a line saying what it is: object, five keys, depth three, 412 values. When it is not, you get the line, the column, the reason and a caret under the character that broke it. Paste a JSON Schema alongside and every rule failure is located by JSON Pointer.

Try an example loads a config file that is not strict JSON, to show what the tolerant reader forgives.

Saying something useful when nothing is wrong

A formatter's job ends when the document is reformatted. A validator's job is to deliver a verdict, and "valid" on its own is the least informative true thing a tool can say. So this page reports the shape:

Valid JSON · object · 5 keys · depth 3 · 412 values

Four facts, each of which catches a different mistake. The type catches the case where you expected an array of records and have a single object, which is the most common reason an import produces one row instead of a thousand. The key count catches a truncated paste. The depth tells you what you are in for when the next step is flattening. The value count is the number of scalars in the whole document, which is the closest thing to a size that means anything.

Depth is counted the way you would count it by eye: a scalar is depth 0, a flat object is depth 1, and an object holding an object holding an array of numbers is depth 3.

Saying where, when something is wrong

Here is a document with a trailing comma, and what three tools say about it.

{"a":1,"b":[1,2,{"c":3}],"d":{"e":"f"},}

The raw browser message, which most validators pass straight through:

Invalid JSON: Expected double-quoted property name in JSON at position 39 (line 1 column 40)

A slightly better one, which rewords it but still leaves you counting characters:

Invalid JSON at line 1, column 40. Property names must be double-quoted strings.

This page:

Invalid JSON at line 1, column 40: Expected double-quoted property name.
1 | {"a":1,"b":[1,2,{"c":3}],"d":{"e":"f"},}
  |                                        ^

The first sentence is self-contained, so it still reads correctly anywhere the monospace block cannot be shown. The caret is what makes the difference on a real file: on line 1,204 of a minified document, "column 40" is a number you have to go and find, and a caret under the character is a place you can look at.

What the tolerant reader forgives

Half of what people paste into a JSON validator is not strict JSON and was never going to be: a config file with comments in it, a dictionary copied out of a Python shell, an object lifted from a JavaScript source with unquoted keys, a snippet that went through a word processor and came back with curly quotes.

Leave Forgive comments, trailing commas and quotes on and all of those are read, and the note above the result says exactly what had to be forgiven. That is the important half: a person who does not know their file used single quotes learns nothing from a tool that silently accepts it, and will paste the same thing into the next one.

{
  // a config file, not strict JSON
  'service': 'billing',
  replicas: 3,
  enabled: True,
  limits: { cpu: '500m', memory: '512Mi', },
}

reads as valid, with the note:

Read as relaxed JSON (fixed: comments, single-quoted strings,
unquoted keys, Python True/False/None, trailing commas). A strict
JSON parser would refuse the input as it stands.

Turn the option off and the same document is a syntax error with a caret under the first comment. Which of those two behaviors you want depends on whether you are checking a config file or checking an API payload, and that is exactly the choice the toggle offers.

Schema validation, located by pointer

Paste a JSON Schema into the second box and the document is checked against it. Every failure is reported separately with a JSON Pointer to the offending value, because a person fixing a payload wants the whole list, not the first problem.

Document:

{"name":"","age":-3,"extra":1}

Schema:

{
  "type": "object",
  "required": ["name", "age", "email"],
  "additionalProperties": false,
  "properties": {
    "name":  { "type": "string", "minLength": 1 },
    "age":   { "type": "integer", "minimum": 0 },
    "email": { "type": "string", "format": "email" }
  }
}

Result:

Valid JSON · object · 3 keys · depth 1 · 3 values

Schema: 4 problems.

/email is required and missing
/name must be at least 1 characters, but it is 0
/age must be at least 0
/extra is not allowed: the schema sets additionalProperties to false

The supported keyword set is the draft-07 subset that people actually write: type (including a list of types), required, properties, additionalProperties, enum, const, minLength, maxLength, pattern, format, minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, items, minItems, maxItems, uniqueItems, minProperties, maxProperties, allOf, anyOf, oneOf and not. The format checks cover date-time, date, time, email, uri, uuid, ipv4 and hostname.

JSON Lines, and other things that are nearly JSON

  • JSON Lines (one value per line, no surrounding array) is recognized. A whole-document parse fails on it, so the validator retries line by line and, when most lines parse, reports the error against the line number rather than against a character offset in a document the file was never meant to be.
  • A byte order mark at the start, which Windows tools add and which makes the first character of the document invisible-but-present, is stripped before parsing. Left in place it produces an "unexpected token" at position 0 that looks impossible.
  • A truncated paste produces "unexpected end of input", located at the end of the document rather than nowhere, which is what the raw message gives you.
  • A schema that is itself broken is reported separately, with its own line and column, so you are never told your document is invalid when the problem is in the rules.

When you want the document reformatted rather than judged, the JSON formatter is the page for that, and it shares this error reporting.

Frequently Asked Questions

What is the difference between this and the JSON formatter?

They answer different questions. The formatter's output is your document, reformatted. This page's output is a verdict: what the document is when it is valid, and exactly where and why when it is not. Schema validation only lives here, and only this page prints the "object, 5 keys, depth 3" summary.

Which JSON Schema draft does it support?

The draft-07 keyword set that people actually write, listed in full above. It does not resolve $ref to external URLs, because that would mean fetching from a browser tab that promises to make no network requests. Local definitions referenced by $ref are not resolved either; inline the subschema and it validates.

Does it stop at the first schema error?

No. Every rule is checked and every failure is listed with its own JSON Pointer. Stopping at the first one turns a five-minute fix into five round trips.

Can I validate a file rather than pasting?

Yes. Drop a .json, .jsonl, .ndjson or .txt file on the box, up to 100 MB, with no line limit under that. The error reporting works the same way, which is where the caret earns its keep: on a large minified file a column number alone is close to useless.

My document is valid but my tool rejects it.

Check the note above the result. If it says the document was read as relaxed JSON, then it is not strict JSON and your tool is right to refuse it. The note names exactly what had to be forgiven, which is the list of things to fix.

What does the depth number count?

How many levels of nesting the deepest branch has. A scalar is 0, a flat object or array is 1, and each further level of object or array adds one. It is the number to look at before flattening, because it tells you how long the resulting key paths will be.

Does anything I paste leave my computer?

No. There is no upload endpoint on this page and no network request in the code that does the work. JavaScript in your own tab reads the text, processes it and hands back the result. Nothing is stored between visits either, so reloading gives you an empty box again. You can confirm it by opening your browser's network panel and watching it stay quiet while you work.

Find out what is wrong with it

Free, no account, no upload. The line, the column, the reason and a caret under the character.

Back to the validator