JSON Validator & Formatter

Validate, format, and beautify JSON data with syntax checking, error detection, and formatting options.

Indent:
Input JSON
Formatted Output

Validation

Checks JSON syntax and structure, reporting errors with line numbers.

Formatting

Beautifies JSON with customizable indentation and optional key sorting.

Minification

Remove all whitespace to create compact JSON for production use.

About the JSON Validator

This JSON validator checks whether your JSON parses and reports the exact line and position of any error. Once valid it can format, minify or sort keys, all in your browser.

A JSON validator answers a binary question — does this parse — and then the useful one, which is where it broke. JSON is strict by design, so a single misplaced character invalidates an entire document.

The failures are always the same few things. A trailing comma after the last element, which JavaScript tolerates and JSON does not. Single quotes instead of double. An unescaped quote inside a string. A comment, which JSON has no concept of. And a missing closing brace, usually a long way from where the error is reported.

Key sorting is worth knowing about: sorting both sides of a comparison makes two documents diffable even when their keys were written in different orders. Validation runs in your browser, so API responses with real data are never uploaded.

How to use the JSON Validator

  1. Paste your JSON. Enter the document or response.
  2. Read the verdict. Valid, or the line and position of the first error.
  3. Fix the problem. Correct the reported issue and revalidate.
  4. Format or sort. Beautify, minify or sort keys once it parses.

JSON Validator features

  • Validation with line and position of the error
  • Beautify with configurable indentation
  • Minify to strip all whitespace
  • Sort keys to make documents comparable
  • Handles large documents
  • Runs entirely in your browser

Frequently asked questions

Why is my JSON invalid?

Most often a trailing comma, single quotes instead of double, an unescaped quote in a string, or a comment — which JSON does not allow.

Does it tell me where the error is?

Yes, with a line and position. The missing brace is usually reported some distance from where it should have been.

Can JSON contain comments?

No. Comments are not part of the specification, which is why a config file with them fails to parse.

Why would I sort keys?

Sorting both documents makes them diffable even when the keys were originally written in different orders.

Is my JSON uploaded?

No. Validation happens entirely in your browser.