Skip to content

JSON Validator

Check whether a piece of JSON is valid and, if it isn't, see exactly where it breaks: line, column, the offending text and a plain-language hint about the fix. Validation runs as you type, entirely in your browser.

Runs in your browserFreeNo sign-up

Processed on your device. Files and text stay in your browser and are not uploaded to our servers. How privacy works

How to use the JSON Validator

  1. Paste your JSON into the input, or click Paste to read it from the clipboard.
  2. Read the result panel. Valid JSON shows the top-level type, key or item count, nesting depth and size.
  3. For invalid JSON, the panel shows the error line with a caret under the problem and a hint. Jump to error moves your cursor there.
  4. If the only problem is trailing commas, click Remove trailing commas to fix them in one go.

Features

  • Precise error location with line, column and a caret in context
  • Hints for the most common mistakes: trailing commas, single quotes, unquoted keys, comments, undefined and NaN
  • One-click fix for trailing commas
  • Summary of valid documents: type, count, nesting depth, size
  • Handles large documents; the native parser is used first for speed

What counts as valid JSON

JSON is defined by RFC 8259. A document is a single value: an object, an array, a string, a number, true, false or null. Object keys must be strings in double quotes, strings use double quotes only with backslash escapes, numbers can't have leading zeros or a leading plus sign, and there are no comments, no trailing commas and no undefined.

Many things that look like JSON are actually JavaScript object literals, JSON5 or YAML. They may work in a JavaScript file but will be rejected by JSON.parse and by most APIs, which is exactly what this validator reports.

How errors are located

Browsers' built-in JSON.parse gives inconsistent, often vague error messages. This tool parses the text with its own position-tracking parser whenever the built-in parser fails, so the reported line and column are consistent across Chrome, Firefox and Safari, and the message describes the actual problem rather than “unexpected token”.

Frequently asked questions

The JSON works in my JavaScript code. Why is it invalid here?

JavaScript accepts object literals with single quotes, unquoted keys, trailing commas and comments. JSON accepts none of these. Use JSON.stringify on your object to get valid JSON.

Does it validate against a JSON Schema?

Not yet. This tool checks syntax. Schema validation is on the roadmap.

Can it fix errors automatically?

It fixes trailing commas with one click, since that is by far the most common mistake. Other problems are reported with a hint so you can fix them safely yourself.

Is my JSON uploaded?

No. Validation happens in your browser only.

Other tools people use alongside JSON Validator.

You might also like

Something useful from another corner of VoltKit.