JSON Formatter
Format and pretty print JSON online with 2 spaces, 4 spaces or tabs and optional sorted keys. Invalid JSON is reported with its line and column.
How to use it
Paste JSON to see it indented as you type. Choose the indent, tick Sort keys to order object keys alphabetically, and if the JSON is invalid the error shows the line and column to fix.
About this tool
Paste JSON and it is indented as you type, with the error position shown if it is not valid. Everything runs in your browser, so the JSON you paste is never uploaded.
Frequently asked questions
- How do I format JSON online?
- Paste your JSON into the box and it is pretty printed straight away. Pick 2 spaces, 4 spaces or tabs for the indent.
- How do I find the error in invalid JSON?
- If the JSON cannot be parsed, the tool shows the parser message with the line and column of the problem. Common causes are trailing commas, single quotes and unquoted keys.
- Can it sort the keys?
- Yes. Tick Sort keys to order the keys of every object alphabetically, which makes two JSON documents easier to compare.
- Is my JSON sent to a server?
- No. Formatting happens in your browser with JavaScript, so the data stays on your machine.