JSON Validator

Find out whether a piece of text is valid JSON and, if it is not, exactly where it breaks. The report shows the line and column of the first problem, a short excerpt with a caret, and a hint for common mistakes such as trailing commas, single quotes, unquoted keys, comments or a missing comma.

Format & Validate Runs in your browser

Validate Your JSON

How to Use the JSON Validator

  1. Paste your JSON into the box.
  2. Press Check.
  3. Read the verdict. The word Valid or Invalid and an icon are shown, not just a colour.
  4. For an invalid document, fix the problem at the reported line and column (it is selected in your input) and check again.

About This Tool

Developers debugging a rejected API request, people editing configuration files by hand, and students learning the JSON syntax.

Input: JSON  ·  Output: Validation report.

Features and Limitations

Features

  • Reports the first syntax error with line, column, excerpt and a plain-English explanation.
  • Recognises the usual mistakes: trailing commas, single quotes, unquoted keys, comments, curly quotes, NaN or undefined, leading zeros, missing commas and brackets that do not match.
  • For valid JSON it counts objects, arrays, keys, strings, numbers and nesting depth.
  • Warns about duplicate keys and numbers too large or too precise for JavaScript.

Limitations

  • It checks syntax only. It does not check the data against a JSON Schema.
  • Only the first error is reported; fix it and check again to find the next one.
  • Strict JSON only: JSON5 and JSON with comments are reported as invalid.
  • Results are computed in your browser; nothing you enter is sent to a server.

Example

The text {"a": 1, "b": [1, 2,]} is reported as invalid: “Trailing comma before ]” at line 1, column 22.

Frequently Asked Questions

Why is a trailing comma invalid?

The JSON standard does not allow a comma after the last item of an object or array. JavaScript and some config formats accept it, but a strict JSON parser rejects the whole document.

Are single-quoted strings valid JSON?

No. JSON strings and keys must use double quotes. The validator tells you where it found a single quote.

Does it validate against a schema?

No. It confirms the syntax is correct. Checking required fields or value types needs a JSON Schema validator.

Is a plain number or string valid JSON on its own?

Yes. Since RFC 8259 any JSON value may be the top-level value, so 42, "text", true and null are valid documents.

Does my data leave the browser?

No. Validation runs locally and nothing is uploaded.

Related Tools

More like this: all Format & Validate tools, all Developer & Web tools or the TinySandy home page.