JSON formatter
Format, validate and minify JSON.
How it’s calculated
Uses your browser’s built-in JSON parser. Errors show the line and column where parsing stopped.
Related tools
Everything runs in your browser. Nothing you paste is uploaded. Calculations run in your browser; nothing you enter is stored. Read our disclaimer.
About this JSON formatter
This JSON formatter turns messy JSON into clean, readable text. It also works as a JSON validator and a JSON minifier. First, paste your JSON. Then format it, minify it or check that it is valid. In addition, it shows the line and column of any error. Your data stays in your browser.
How to use the JSON formatter
- First, paste your JSON into the top box.
- Next, choose an indent: 2 spaces, 4 spaces or a tab.
- Then click Format to pretty print it, or Minify to remove spaces.
- Alternatively, click Validate to check it without changing it.
- Finally, click Copy result to copy the output.
JSON format example
For example, take this minified JSON: {"name":"Modelodge","tools":25}. After you click Format with 2 spaces, each key sits on its own line. As a result, it is much easier to read. By contrast, Minify turns it back into a single line.
Common JSON errors
Most invalid JSON comes from a few small mistakes. First, JSON needs double quotes, so single quotes cause an error. Second, every key must sit inside double quotes. Third, JSON does not allow a trailing comma after the last item. Also, JSON does not allow comments. Finally, true, false and null must be lowercase.
Pretty print vs minify
Pretty print adds line breaks and indentation for people to read. By contrast, minify removes all extra spaces to make the data smaller. So use pretty print while you debug. Then use minify for data you send over a network.
JSON formatter FAQs
What is a JSON formatter?
A JSON formatter adds line breaks and indentation to JSON. As a result, nested data becomes easy to read. People also call it a JSON beautifier or pretty printer.
How do I validate JSON?
Paste it and click Validate. If the JSON is valid, you see a “Valid JSON” message. Otherwise, you see the error with its line and column.
Why is my JSON invalid?
The most common causes are single quotes, unquoted keys, a trailing comma or a comment. So check the line and column the tool reports.
Is my JSON uploaded anywhere?
No. The formatter uses your browser’s built-in JSON parser. So your data never leaves your device.
What does minify JSON mean?
Minifying removes the spaces, tabs and line breaks that JSON does not need. So the data stays the same, but it gets smaller.
Convert epoch times found in JSON with the Unix timestamp converter. Also, count tokens in an API payload with the LLM token counter. Finally, browse all Lodge Tools.
