Skip to content

JSON Formatter & Validator

Format, minify and validate JSON in your browser. Choose 2 spaces, 4 spaces or tabs, and get the exact line and column of any syntax error.

  • Free, no sign-up
  • Runs in your browser
  • Developer
Paste up to 1,000,000 characters. Everything runs in your browser; your data is never uploaded.

Read the guide What Is JSON? Syntax Rules and Common Errors

How to use the JSON formatter

  1. Paste your JSON into the box. Up to 1,000,000 characters are accepted.
  2. Pick an indentation: 2 spaces, 4 spaces or a tab.
  3. Press Format to pretty-print it, Minify to remove all optional whitespace, or Validate to check it without producing output.
  4. Use Copy result to put the output on your clipboard.

If the JSON is invalid, the result card shows the line and column of the first problem, a short reason and the offending line with a caret under the exact spot. The position is also selected in the input box so you can fix it straight away.

Your data stays on your device

Everything happens in your browser. The JSON you paste is never sent to our server, so it is safe to use with configuration files, API responses and other private data.

How it works

The tool reads the text once from start to finish and checks it against the JSON grammar (RFC 8259): objects, arrays, double-quoted strings, numbers, true, false and null. While reading, it writes each piece back out with the whitespace you chose.

Because strings and numbers are copied exactly as written, nothing is changed by accident. Large numbers such as 12345678901234567890 keep every digit, escape sequences like \u00e9 stay as they are, and repeated keys are kept in their original order.

Worked example

Formatting {"name":"Ada","tags":["math","code"],"active":true} with 2 spaces gives 8 lines: the opening brace, one line for each property, the two array items indented by 4 spaces, the closing bracket of the array and the closing brace. The nesting depth is 2.

Now take this input, which has a comma after the last property:

  • line 1: {
  • line 2: "name": "Ada",
  • line 3: "age": 36,
  • line 4: }

With two spaces of indentation on lines 2 and 3, the tool reports line 3, column 12 and the message "Trailing comma: remove the comma before the closing brace".

Good to know

  • JSON does not allow comments, trailing commas, single quotes or unquoted words such as undefined and NaN. These are the most common errors and each gets its own message.
  • Only one top-level value is allowed. To keep several records together, put them in an array.
  • An invisible byte order mark at the very start of a file is ignored.
  • Column numbers count characters, so an emoji counts as one column.

Frequently asked questions

Is my JSON uploaded anywhere?

No. Formatting and validation run entirely in your browser, and nothing you paste is sent to our server or stored. You can even go offline after the page has loaded.

Why does the error point to a different place than my editor?

Different programs describe errors in different words and sometimes point at the character before or after the problem. This tool always points at the first character that breaks the JSON rules, counting lines and columns from 1.

Will formatting change my numbers?

No. Many formatters convert numbers to floating point and back, which can round very large integers or turn 1.10 into 1.1. This tool copies every number exactly as you wrote it.

What is the difference between Format and Minify?

Format adds line breaks and indentation so the structure is easy to read. Minify removes every optional space and line break, producing the smallest valid JSON, which is useful for sending data over a network or storing it compactly.

Can it handle very deeply nested JSON?

Yes. The checker does not use recursion, so even tens of thousands of nested arrays or objects are processed without running out of stack space.