JSON Formatter & Validator

Format, validate and minify JSON instantly. Errors point to the exact line and column.

Was this tool helpful?

How to use the JSON Formatter

  1. 1Paste your JSON.
  2. 2Click Format or Minify.
  3. 3Fix any errors shown, then copy or download the result.

Common JSON errors

Trailing commas after the last item, single quotes instead of double quotes, unquoted property names and comments are not allowed in standard JSON. The validator shows the line and column of the first problem so you can fix it quickly.

JSON vs JavaScript objects

RuleJSONJavaScript
Key quotesDouble quotes requiredOptional
StringsDouble quotes onlySingle, double or backticks
Trailing commasNot allowedAllowed
CommentsNot allowedAllowed
Valuesstring, number, boolean, null, object, arrayAlso undefined, functions, dates…

Pretty print or minify?

Pretty-printed JSON (2-space indent) is easiest to read and review. Minified JSON removes all whitespace and can be 10–30% smaller, which matters for APIs and config files sent over the network. Both contain exactly the same data.

Worked example: finding the error

Paste this and press Format: {"name": "Ana", "tags": ["a", "b",]}. The validator stops at the trailing comma after "b" and reports the line and column, because standard JSON doesn't allow a comma before a closing bracket. Remove it and the same text formats cleanly with 2-space, 4-space or tab indentation.

What standard JSON does not allow

  • Trailing commas after the last item in an object or array.
  • Single quotes: strings and property names need double quotes.
  • Comments (// or /* */). Config formats such as JSONC or JSON5 allow them, but standard JSON parsers reject them.
  • Unquoted property names, undefined, NaN and Infinity.

Two limits to know before you format

Very large integers lose precision. The formatter parses JSON with JavaScript, which stores numbers as 64-bit floating point, so whole numbers above 9,007,199,254,740,991 can change: 9007199254740993 comes back as 9007199254740992. If your data has long numeric IDs, keep them as strings or check them after formatting.

Duplicate keys collapse. If an object has the same key twice, only the last value survives formatting, which can hide a bug in the data you are inspecting.

Frequently asked questions

Is my JSON sent to a server?

No. Parsing and formatting happen locally in your browser, which makes it safe for API keys and private data.

Can it sort keys?

Yes. Turn on 'Sort keys' to order object keys alphabetically, which makes JSON easier to compare.

Why did a number in my JSON change after formatting?

Integers larger than 9,007,199,254,740,991 can't be stored exactly as JavaScript numbers, so they are rounded when parsed. Store long IDs as strings to keep them exact.

What does Minify do?

It removes all spaces and line breaks that aren't inside strings, giving the smallest valid JSON for APIs and storage. The data itself doesn't change.