JSON Formatter
Format, validate, minify and sort JSON.
About this tool
Paste JSON to pretty-print it with your preferred indentation, minify it for transport, or sort keys alphabetically to make diffs readable. Syntax errors are reported with line and column.
How to use it
- Paste your JSON into the Input box, or paste it into the search with ⌘K and pick JSON Formatter.
- Choose 2 spaces, 4 spaces, tabs, or Minify to put everything on one line.
- Turn on Sort keys if you want keys in alphabetical order, which makes two versions easier to compare.
- Copy the result. If the JSON is invalid, the error shows the line and column to fix.
Questions
- Why is my JSON invalid?
- The usual causes are a trailing comma after the last item, single quotes instead of double quotes, unquoted keys, or comments. JSON allows none of these. The error message points to the exact line and column.
- Can it read a Python dict or a JavaScript object?
- Yes. Values with single quotes, True, False, None, unquoted keys or trailing commas are converted to valid JSON automatically, and the status line tells you it happened.
- Is it safe to paste API responses with personal data?
- Yes. Formatting happens in your browser and nothing is sent to a server, so you can paste production data without it leaving your machine.
- What is the difference between formatting and minifying?
- Formatting adds line breaks and indentation so people can read it. Minifying removes all optional whitespace so the payload is as small as possible for sending over the network.
Something not working, or a result looks wrong? Report a problem with this tool