JSON Formatter & Validator

A JSON formatter turns compact JSON into readable, indented text and tells you exactly where any error is. Paste JSON below to beautify, minify or validate it, with line and column numbers for errors.

Reviewed by ToolNook editorial team Updated Sources

Output
–

What is a JSON formatter?

JSON (JavaScript Object Notation) is the most common format for exchanging data between web services, apps and configuration files. Machines produce it as a single compact line, which is efficient but almost impossible for a person to read. A JSON formatter, also called a beautifier or pretty-printer, adds line breaks and indentation so the structure of objects and arrays is obvious at a glance.

This tool also works the other way: minify strips every unnecessary space to make the payload as small as possible. And it is a strict validator. If the JSON is broken, you get a plain-language explanation such as “Trailing comma before } is not allowed” with the line and column, plus a button that jumps straight to the problem.

How to use it

  1. Paste your JSON into the input box. It is formatted and checked as you type.
  2. Choose Beautify or Minify, and the indentation you prefer.
  3. Tick Sort keys A–Z to order object keys alphabetically at every level, which makes two documents easier to compare.
  4. Copy the result or download it as a .json file. If the JSON is invalid, click Go to error.

Common JSON errors

  • Trailing commas: [1, 2,] is valid in JavaScript but not in JSON.
  • Single quotes: strings and keys must use double quotes: {"a": "b"}, not {'a': 'b'}.
  • Unquoted keys: {a: 1} must be written {"a": 1}.
  • Comments: JSON has no comments. Remove // and /* */ lines.
  • Leading zeros and special values: 007, NaN, Infinity and undefined are not allowed.
  • Raw line breaks inside strings: use \n instead.

Example

The compact input {"name":"ToolNook","tools":53,"free":true} becomes:

{
  "name": "ToolNook",
  "tools": 53,
  "free": true
}

More worked examples

Common error: {"a": 1, "b": 2,} fails at line 1, column 17 with “Trailing comma before } is not allowed in JSON”. Remove the last comma and it validates.

Common mistakes to avoid

  • Using single quotes. JSON strings and keys need double quotes.
  • Leaving trailing commas or comments. Both are valid in JavaScript but not in JSON.
  • Storing long IDs as numbers. Numbers above 253 lose precision; store them as strings. To build structured data, try the JSON-LD schema generator.

Sources and methodology

The calculations on this page follow these published standards and references. The code is covered by automated tests against known values.

Frequently asked questions

Is my JSON sent to a server?

No. Formatting and validation happen in your browser, so API responses containing tokens or personal data never leave your device.

Can it handle large files?

Yes. Files of several megabytes format in well under a second on a modern computer, because there is no upload.

Does sorting keys change my data?

No. JSON objects are unordered by definition, so sorting keys changes only the presentation. Array order is never changed.

Why does a large number lose precision?

JSON numbers are read as standard double-precision values, which are exact only up to 2^53. Very long IDs should be stored as strings.

Does it support JSON with comments (JSONC)?

No. The validator follows the official JSON standard strictly, so comments are reported as errors. Remove them before formatting.