JSON Formatter
Paste your JSON below to format, validate, and beautify it instantly.
What is JSON Formatter?
JSON (JavaScript Object Notation) is a lightweight text format for structured data, built from objects (key-value pairs), arrays, strings, numbers, booleans, and null. It's whitespace-insensitive, so minified JSON from an API response or log file is valid but hard to read — this tool re-indents it into a consistent, human-readable structure and checks along the way that it's actually valid JSON.
Formatting uses the browser's native JSON.parse followed by JSON.stringify with your chosen indent width — the same parser your code will use, so if this tool accepts it, your application will too.
- Input: {"name":"Ada","active":true,"tags":["math","cs"]}
- Output (2-space indent): { "name": "Ada", "active": true, "tags": [ "math", "cs" ] }
Reference: ECMA-404 — The JSON Data Interchange Syntax
How to use JSON Formatter
- Paste or type your JSON into the input box.
- Choose an indent width (2 or 4 spaces).
- Read the formatted, validated result — or the exact error location if it's invalid.
Common errors
- "Unexpected token , " — usually a trailing comma after the last item in an object or array; JSON, unlike JavaScript object literals, does not allow trailing commas.
- "Unexpected token ' " — JSON strings must use double quotes; single-quoted strings are valid JavaScript but invalid JSON.
- "Unexpected end of JSON input" — usually a missing closing brace `}` or bracket `]`; check that every opening symbol has a matching close.
- "Unexpected token u" on a value like `undefined` — JSON has no `undefined`; use `null` instead.
FAQ
Why does this tool say my JSON is invalid when it looks fine?
The most common causes are a trailing comma, single quotes instead of double quotes, or an unquoted object key — all valid in JavaScript object literals but not in strict JSON. The error message includes the exact line and column so you can jump straight to the problem.
Is my data uploaded anywhere when I use this formatter?
No — parsing and formatting both happen entirely in your browser using JavaScript's built-in JSON parser. Nothing you paste is sent to a server.
Can I convert minified JSON back to a compact single line?
This tool focuses on beautifying (indenting) JSON. To minify, set the indent to 0, which produces compact output with no extra whitespace.
Does this validate against a JSON Schema, or just check that the JSON itself is well-formed?
Just well-formed JSON syntax — it confirms the text is parseable JSON, not that it matches a particular schema or shape your application expects.