About this JSON formatter
This is a free online JSON formatter and validator from IssueBadge. Paste raw JSON in the box on the left, hit Format, and you get clean indented output with syntax errors flagged by line and column. It also minifies, builds a collapsible tree view, and copies results to your clipboard.
Everything runs in the browser using the native JSON.parse API. No upload, no signup, no telemetry on your data. Useful when you're debugging an API response, cleaning up a config file, or trying to figure out why a payload isn't parsing.
How to format JSON online
- Paste your JSON. Drop the raw text into the Input box. It can be from an API response, a log line, or a config file. The tool accepts both compact and pre-formatted JSON.
- Click an action. Format pretty-prints with 2-space indentation. Minify strips all whitespace to one line. Validate runs the parser and reports the first error. Tree view turns the JSON into a collapsible structure for navigation.
-
Read the output (or the error).
Valid JSON appears on the right. Invalid JSON gets a message like
Unexpected token } at position 142. Use the position number to find the bad character in your input. -
Copy or download.
Use the Copy button to put the result on your clipboard, or download it as a
.jsonfile for sharing.
Common JSON errors and how to fix them
| Error message | What it means | Fix |
|---|---|---|
| Unexpected token } in JSON | Trailing comma before the closing brace. | Remove the comma after the last item: {"a":1,"b":2} not {"a":1,"b":2,}. |
| Unexpected token ' | Single quotes used instead of double quotes. | JSON requires double quotes for strings and keys: "name" not 'name'. |
| Unexpected end of JSON input | Missing closing brace, bracket, or quote. | Count braces and brackets. The tree view makes it easy to spot which one didn't close. |
| Unexpected token N | An unquoted NaN or undefined value. |
JSON does not support NaN, Infinity, or undefined. Replace with null or wrap in quotes if it's meant as a string. |
| Bad escaped character | A backslash inside a string isn't followed by a valid escape sequence. | Valid escapes: \", \\, \/, \b, \f, \n, \r, \t, \uXXXX. Anything else needs the backslash itself escaped: \\. |
| Output has \" everywhere | JSON was double-encoded — a JSON string that was itself stringified. | Format twice. The first pass strips one layer of escaping. |
When to use a JSON formatter
Debugging API responses
Paste the raw response from a REST or GraphQL endpoint to see the structure. The tree view collapses noisy nested objects so you can find the field you care about.
Cleaning up config files
package.json, composer.json, tsconfig.json — any file Git diffs ugly because of inconsistent indentation. Format gives a canonical form.
Reducing payload size
Minify strips whitespace before sending JSON over the wire. For static config served to browsers, this can cut payload size by 30–50% with zero behavior change.
Inspecting log lines
Structured logs often store JSON on a single line. Paste a log entry to read it like a human. Works well for AWS CloudWatch, Datadog, Loki, or any JSON-line format.
JSON syntax in 30 seconds
- Objects use curly braces:
{"key": "value"}. - Arrays use square brackets:
[1, 2, 3]. - Strings must be in double quotes. Keys are strings.
- Allowed value types: string, number, boolean (
true/false),null, object, array. - No comments. No trailing commas. No
undefined, noNaN. - Numbers can be integer or float. Leading zeros and hex are not allowed.
Frequently asked questions
Is this JSON formatter free?
Yes. No signup, no ads inside the tool, no rate limit. It's offered free by IssueBadge.
Is my JSON sent to a server?
No. The formatter uses the native browser JSON parser. Your data stays on your machine, which matters when you're pasting API responses, tokens, or production payloads.
What does "Unexpected token in JSON at position X" mean?
The parser hit a character it didn't expect. Common causes: a trailing comma after the last item, single quotes around strings (JSON requires double quotes), an unescaped backslash, or a missing closing brace. The validator highlights the exact position.
What is the difference between formatting and minifying?
Formatting adds indentation and line breaks so JSON is human-readable. Minifying strips all whitespace to reduce size. Both produce equivalent data — they only differ in formatting.
Does it support large JSON files?
The tool handles files up to about 10MB without slowdown. Beyond that, the browser may stall during the parse step. For very large files, consider a desktop tool like jq.
Can I validate JSON Schema with this?
Not yet. This tool validates JSON syntax (is it valid JSON?) but does not validate against a JSON Schema (does it match a defined structure?). Schema validation is on the roadmap.
Why does my JSON have escaped quotes everywhere?
It's likely double-encoded — a JSON string that was itself stringified. Pasting once strips one layer; you may need to format twice. The tree view exposes this clearly.
Related free developer tools
All Free Tools
See every utility from IssueBadge.
Image Resizer
Resize JPG, PNG, WebP in your browser.
Image Converter
Convert between JPG, PNG, WebP, and more.
Building APIs that issue digital credentials? IssueBadge has a JSON-based REST API for issuing verifiable badges and certificates at scale.