Skip to content
Devtools 360

JSON Formatter and Beautifier

Paste minified or messy JSON and turn it into clean, consistently indented output. Syntax errors are reported with the exact line and column so you can fix them quickly.

Runs in your browserFree · No sign-up

How to format JSON

  1. Paste your JSON into the input box, or open a .json file from your device.
  2. Choose an indentation style: 2 spaces, 4 spaces or tabs. Enable key sorting if you want a stable, alphabetical order.
  3. The formatted result appears instantly. If the JSON is invalid, the error message shows the line and column of the problem.
  4. Copy the result to your clipboard or download it as a .json file.

Supported formats

Input
JSON, .json file
Output
Formatted JSON
Maximum size
20 MB per file (limited by your device's memory)

Common JSON syntax errors

Most invalid JSON comes from a handful of mistakes: trailing commas after the last item, single quotes instead of double quotes, unquoted property names, and comments (JSON does not allow comments). Values like undefined, NaN and Infinity are also not valid JSON. If you only need to check validity, the JSON Validator gives a focused pass/fail report, and the JSON Minifier does the opposite of this tool.

Benefits

  • Precise error positions (line and column) instead of a generic "invalid JSON" message.
  • Optional alphabetical key sorting makes two JSON documents easy to compare.
  • Handles large API responses of several megabytes without freezing the page.

Limitations

  • Only strict JSON (RFC 8259) is accepted; JSON5 features such as comments and trailing commas are reported as errors.
  • Numbers beyond JavaScript's safe integer range (about 9 quadrillion) may lose precision when re-formatted.

Privacy and security

Your JSON is parsed and formatted by JavaScript running in this browser tab. It is never sent to a server, which makes the tool safe for API responses that contain personal data or credentials.

Read our privacy policy for details about the site as a whole.

Frequently asked questions

What is the difference between formatting and validating JSON?

Validation checks that the text is syntactically correct JSON. Formatting goes further and re-prints valid JSON with consistent indentation and line breaks. This tool does both: it formats when the input is valid and reports the error when it is not.

Why does my JSON fail with "Unexpected token"?

The parser found a character it did not expect at that position — usually a trailing comma, a single quote, a comment or a missing comma between items. Check the reported line and the line just before it.

Does sorting keys change my data?

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