JSON Formatter & Validator

Paste JSON below and press Format to make it readable, or Minify to squeeze it into one line. If the JSON is broken, the tool shows where the error is. Everything runs on your device.

How to format and validate JSON

  1. Paste your JSON into the JSON input box.
  2. Press Format for an indented, readable version, or Minify to remove all whitespace.
  3. If the input is not valid, read the error message – it gives the line and column, and the cursor jumps to that spot.

JSON syntax rules

JSON (JavaScript Object Notation) is a text format for exchanging data. It has only six kinds of values: objects in curly braces, arrays in square brackets, strings, numbers, true/false and null.

  • Keys and strings must use double quotes – single quotes are not allowed.
  • No trailing comma after the last item.
  • No comments.
  • Numbers cannot have leading zeros, and NaN or undefined are not valid values.

Format or minify?

  • Formatted JSON is for people: use it when reading API responses, reviewing configuration files or comparing versions.
  • Minified JSON is for machines: it is smaller, so it transfers faster and takes less storage.
  • Indentation is a matter of convention: 2 spaces is most common, 4 spaces and tabs are also widely used.

Frequently asked questions

Is my JSON sent to a server?

No. Parsing and formatting happen entirely in your browser, so it is safe for private data.

Does formatting change my data?

No values are changed, but duplicate keys keep only the last value and very large numbers may lose precision, as in any JavaScript parser.

Why is my JSON invalid?

The most common causes are single quotes, a trailing comma, unquoted keys, comments, or a missing bracket or brace.

Is the order of keys kept?

Yes, except that keys that look like whole numbers are moved to the front in ascending order.

Related tools