JSON Formatter
Format, validate and minify JSON in your browser.
What this tool does
JSON formatter that beautifies, validates or minifies any JSON inside your own browser. Paste the content, choose the action and the output appears formatted, without sending anything to a server.
If you're debugging an API, you'll also want regex tester for field extraction and Base64 encoder to crack JWT payloads.
What you can use it for
- Beautify a minified JSON returned by an API to read it more easily.
- Minify a JSON before pasting it into a configuration file.
- Spot syntax errors when an endpoint returns something odd.
- Sort the keys of a JSON to review it through a diff.
How to use it
- Paste the JSON into the input area.
- Pick the action: beautify, minify or just validate.
- If you beautify, pick the indent (2 spaces, 4 spaces or tab).
- Toggle the sort-keys option if you want the result alphabetized.
Everything runs inside your browser. No file is uploaded to any server. See more tools in this field.
Most common JSON errors
When validation fails, it's almost always one of these reasons. Learning to read them saves a lot of round-trips.
- 01
Unexpected token } in JSON at position N
Cause
There's a trailing comma before the object's closing brace.
How to fix it
Remove the last comma. JSON does not allow trailing commas, unlike JavaScript.
- 02
Unexpected token " in JSON at position N
Cause
A key or value starts with quotes that aren't closed or are duplicated.
How to fix it
Check every string starts and ends with the same double quote. JSON does not allow single quotes.
- 03
Unexpected end of JSON input
Cause
A missing closing object, array or string.
How to fix it
Count opened and closed braces. Usually a } or ] is missing at the end.
- 04
Unexpected token N in JSON at position N
Cause
A key is not wrapped in quotes.
How to fix it
JSON requires double quotes around keys too. Wrap every key in double quotes.
- 05
Bad escaped character in string
Cause
There's a backslash inside a string that doesn't introduce a valid escape.
How to fix it
Escape backslashes by doubling them (\\) or use regular characters. Only \", \\, \/, \b, \f, \n, \r, \t and \uXXXX are valid.
Pairs well with
Other tools people reach for in the same flow.
- Base64 Encoder/Decoder
encode and decode Base64 text
Essential when debugging an API.
- Regex Tester
test regular expressions
Strong fit in developer workflows.
- JWT DecoderComing soon
Essential when debugging an API.
- Text CompareComing soon
Diff two payloads side by side.
Related tools
DeveloperRegex Tester
Test and debug regular expressions in real time, with capture groups.
Base64 Encoder/Decoder
Encode and decode Base64 text, with optional URL-safe alphabet.
UUID Generator
Generate cryptographic UUID v4 identifiers on demand.
Slug Generator
Turn any text into a clean URL slug.
Frequently asked questions
What does beautify do exactly?
It reformats the JSON with line breaks and indentation so it's readable. It does not change values or key order unless you turn on the sort option.
And minify?
It strips every unnecessary space, tab and line break. The resulting JSON takes the minimum size possible while preserving the same meaning.
What happens if the JSON has an error?
The validator shows the exact position of the error (line and column) and a description of what was expected. It's usually a trailing comma, an unclosed quote or a key without a value.
Does it support JSON with comments or JSON5?
Standard JSON does not allow comments. If you paste JSON5 with comments and trailing commas, validation will fail. Remove them first or use a specific tool for that format.
