Skip to content
Document tools

JSON Formatter

Pretty-print, validate and tidy JSON in your browser, with exact error positions.

Format your JSON

Result
Paste your JSON and press Format JSON. The result appears here.
Runs in your browser. Nothing you paste or open is uploaded. Numbers are kept exactly as written, so long IDs are never rounded.

About this tool

Paste JSON or open a .json file and press Format to get it neatly indented with 2 spaces, 4 spaces or tabs. If the JSON is broken, you see what is wrong with the exact line and column, and the cursor jumps to the spot. You can also sort object keys alphabetically, which makes two files easier to compare, and copy or download the result.

Everything runs in your browser, so API responses, configuration files and logs never leave your device. The formatter keeps numbers exactly as written, so long IDs and precise decimals are never rounded, and it warns you about duplicate keys.

How it works

  1. Paste or open JSONPaste text, or open a .json file up to 10 MB.
  2. Choose the indentationTwo spaces, four spaces or tabs, and whether to sort keys.
  3. Format, then copy or downloadFix any error it points to, then copy or save the result.

Questions people ask

Is my JSON uploaded?
No. Formatting and checking happen in your browser. Nothing you paste or open is sent to our server.
Will large numbers be changed?
No. JavaScript would turn 12345678901234567890 into 12345678901234567000, so this formatter does not convert numbers at all and keeps every one exactly as you wrote it.
Does it accept comments or trailing commas?
No. They are not allowed in standard JSON, so the formatter points them out as errors with their line and column. Remove them and format again.
How big can the JSON be?
Up to 10 MB, pasted or opened from a file.
Good to know

Getting the most from the formatter

Press Ctrl+Enter

Format straight from the editor with Ctrl+Enter (Cmd+Enter on a Mac), without reaching for the button.

Sort keys to compare files

Sorting keys A to Z puts two versions of the same data in the same order, so a diff shows only the real changes.

Fix the first error first

One missing comma can confuse everything after it. Fix the error shown, format again, and repeat until it passes.