Home › Developer & Design › JSON Formatter

JSON Formatter

Make JSON readable, compact it, or find out why it will not parse.

How to format JSON

  1. Paste your JSON.
  2. Choose 2 spaces, 4 spaces or Minify.
  3. Read the status message, then Copy.

What it does

JSON is a text format for exchanging data between programs. Formatting adds line breaks and indentation so you can see the structure. Minifying removes unnecessary space to shorten it.

Common reasons JSON is invalid

ProblemWrongCorrect
Trailing comma[1, 2,][1, 2]
Single quotes{'a': 1}{"a": 1}
Unquoted name{a: 1}{"a": 1}
Comment{"a": 1} // note{"a": 1}

Missing closing brackets are another frequent cause. Your browser's error message may give a position or line; check that place and the characters just before it.

Types JSON allows

Objects, arrays, strings, numbers, true, false and null. Dates are usually stored as strings, and "undefined" is not allowed.

Can formatting change data?

It can. If an object repeats a property name, only the last value is kept. Very large or very precise numbers may be rewritten. The tool refuses to rewrite text containing a whole number too large to hold exactly. Keep your original for important files.

Privacy

Processing happens in your browser. Still, remove access tokens and personal data before copying results into messages or tickets.

Debugging an API response

Paste the response body only, without status lines or headers. If it begins with an angle bracket, the server may have returned an HTML error page instead of JSON. Format valid data, then follow the nesting from the outer object inward. Compare field names carefully, because they are case sensitive: "userId" and "userid" are different names.

Frequently Asked Questions

Does it check my data against a schema?

No. It checks only whether the text is valid JSON.