Skip to content
DevTrove

JSON & Data

JSON Formatter

Pretty-print JSON with 2-space, 4-space or tab indentation, with clear error locations.

Runs in your browser

Press Ctrl+Enter (⌘+Enter on Mac) to format.

How to use

  1. Paste or type JSON into the input box.
  2. Choose an indentation: 2 spaces, 4 spaces or tabs.
  3. Select Format, or press Ctrl+Enter (⌘+Enter on Mac) in the input box.
  4. If the JSON is invalid, fix the reported line and column and format again.
  5. Use Copy output to copy the formatted JSON.

What this formatter changes — and what it doesn't

The formatter only changes whitespace between tokens: it adds line breaks and indentation. Strings, escape sequences, numbers, key order and duplicate keys are copied exactly as you wrote them.

Many formatters parse JSON into JavaScript values and serialize it again, which silently changes data: integers larger than 2^53 lose precision (12345678901234567890 becomes 12345678901234567000), 1.0 becomes 1, and numeric keys are reordered. This tool avoids that, so the output is the same JSON as the input.

Strict JSON validation

Input is checked with your browser's built-in JSON parser, following the JSON standard (RFC 8259). Invalid input is never repaired or guessed at: comments, trailing commas, single quotes, unquoted keys and values like NaN are reported as errors, and no output is produced.

When the browser reports where the error is, the formatter shows the line and column so you can find it quickly.

Limits

Input is limited to 5,000,000 characters. Formatting very deeply nested JSON can make the output much larger than the input, so output is limited to 20,000,000 characters.

FAQ

Is my JSON uploaded?
No. Validation and formatting run entirely in your browser. Your JSON is not sent to a server, not stored, and not added to the page URL.
Does it support JSON5, comments or trailing commas?
No. The formatter accepts standard JSON only, so it never produces output that other JSON parsers would reject.
Why are duplicate keys kept?
The JSON standard allows them, and removing one would change your data. They are kept in their original order so you can decide how to fix them.