JSON Formatter
A JSON formatter takes raw JSON — the data format behind most APIs — and reprints it with consistent indentation so humans can read it; it can also validate JSON and pinpoint syntax errors. FreeToolsKit's formatter formats with 2 or 4 spaces, minifies back to one line, and reports size and key counts. Your JSON is processed in your browser and never sent to a server.
Last updated: October 20, 2026
Key takeaways
- Format JSON with 2-space or 4-space indentation, or minify it back to a single line.
- Invalid JSON produces a precise error with line and column, so you can jump straight to the problem.
- Stats show the input size, total key count and number of values in the document.
- All parsing happens in your browser — pasted data, tokens and payloads never leave your device.
How do you format or validate JSON?
- Paste your JSON into the box — or press “Load sample” to see the tool work on an example.
- Press Format and choose 2 or 4 spaces if you want a different indent.
- If the JSON is invalid, read the error message — it names the line and column of the problem.
- Use Minify when you need the compact one-line version, for example for a config value.
- Press Copy to take the result, or Clear to start again.
What is the JSON Formatter used for?
- Reading a cramped API response by spreading it into readable, indented lines.
- Hunting a syntax error in a config file after an app refuses to start.
- Minifying JSON before embedding it in an environment variable or a request.
- Checking a webhook or analytics payload before sending it to a third-party service.
- Comparing two payloads by formatting both the same way first.
Frequently asked questions
What does the validator check?
It checks the text against the JSON specification: matched braces and brackets, quoted keys, commas in the right places, and valid literals (true, false, null, numbers, strings). The first problem found is reported with its line and column.
Why does it reject trailing commas and comments?
Strict JSON does not allow trailing commas, comments or single-quoted strings — those belong to JavaScript, not JSON. If your file uses them, the error message will point at the first offending character.
Is my JSON sent anywhere?
No. Parsing uses the browser's built-in JSON engine inside your tab. Payloads containing tokens or personal data stay on your device — nothing is uploaded or logged.
What is the difference between Format and Minify?
Format adds line breaks and indentation so people can read the structure. Minify removes all optional whitespace so the same data takes the fewest bytes — the content is identical either way.
Related tools
Base64 Encoder / Decoder
Encode and decode Base64 for text and files, with data-URI preview.
Use tool →UUID Generator
Generate bulk v4 UUIDs and copy them all in one click.
Use tool →Word Counter
Count words, characters, sentences and reading time as you type.
Use tool →Case Converter
Switch text between UPPER, lower, Title, Sentence case and more.
Use tool →Password Generator
Generate strong, crypto-random passwords with a strength meter.
Use tool →More in Developer Tools: Base64 Encoder / Decoder, UUID Generator