JSON Formatter and Validator

Pretty-print, validate and minify JSON, with clear error messages.

Runs in your browser. Your input is not uploaded.

Indent

Paste JSON to format it instantly. Press Ctrl + Enter (⌘ + Enter on Mac) to format.

Lines
0
Size
0 B

How to use the JSON formatter

  1. Paste or type your JSON into the Input JSON box. Pasting formats it straight away.
  2. Choose Format to pretty-print it, Minify to remove whitespace, or Validate only to check it without changing anything.
  3. If there is a problem, the message tells you what is wrong and where. Use Go to error to jump straight to it.
  4. Copy the result with the Copy button.

What it checks

The validator follows the JSON standard (RFC 8259) strictly. As well as reporting the line and column of a syntax error, it explains common mistakes in plain English:

MistakeExampleFix
Trailing comma[1, 2,]Remove the last comma
Single quotes{'name': 'Ada'}Use double quotes
Unquoted property names{name: "Ada"}Quote the name: "name"
Comments// noteRemove them; JSON has no comments
JavaScript valuesundefined, NaNUse null or a number
Missing comma{"a": 1 "b": 2}Add a comma between items

It also warns about valid JSON that may not behave as you expect: duplicate keys (only the last value is kept) and numbers too large to be represented exactly in JavaScript.

Options

  • Indent: two spaces, four spaces or tabs. Two spaces is the most common style for JSON.
  • Sort keys A–Z: orders object properties alphabetically at every level, which makes two JSON documents easier to compare. Array order is never changed.

Limitations

  • Input is limited to 10 million characters and 500 levels of nesting. Very large documents may take a moment to format.
  • Relaxed formats such as JSON5, JSONC or JSON Lines (one value per line) are not supported.
  • Formatting re-writes numbers in a normalised form, so 1.0 becomes 1 and 1e3 becomes 1000.

Frequently asked questions

Is my JSON sent anywhere?

No. Formatting and validation happen in your browser using JavaScript on this page. Your JSON is not uploaded, logged or stored. You can even disconnect from the internet after the page loads and the tool keeps working.

Why did a large number change in the output?

JSON allows numbers of any size, but JavaScript stores numbers as 64-bit floating point values. Integers above 9,007,199,254,740,991 (253 − 1) cannot be represented exactly and are rounded when the JSON is re-written. The formatter warns you when this happens. If your data uses large IDs, it is safer to store them as strings.

Can I format JSON with comments or trailing commas?

Not at the moment. Comments and trailing commas are allowed by relaxed formats such as JSON5 and JSONC (used in some configuration files), but not by standard JSON. The validator tells you exactly where they are so you can remove them.

What is the difference between formatting and minifying?

Formatting (pretty-printing) adds line breaks and indentation so people can read the structure. Minifying removes all unnecessary whitespace to make the data as small as possible, which is useful for sending over a network or embedding in code. Both produce exactly the same data.