JSON Formatter
Pretty-print, validate and tidy JSON in your browser, with exact error positions.
Format your JSON
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
- Paste or open JSONPaste text, or open a .json file up to 10 MB.
- Choose the indentationTwo spaces, four spaces or tabs, and whether to sort keys.
- Format, then copy or downloadFix any error it points to, then copy or save the result.
Questions people ask
Is my JSON uploaded?
Will large numbers be changed?
Does it accept comments or trailing commas?
How big can the JSON be?
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.
