JSON Formatter & Validator
JSON (JavaScript Object Notation) is the most common format for exchanging data between web services, but API responses and log lines usually arrive as one long unreadable line. The JSON Formatter turns that line into neatly indented, syntax-highlighted JSON that you can actually read, and tells you immediately if the document is invalid.
Everything happens locally in your browser, so it is safe to paste API responses, configuration files or production payloads — nothing is uploaded anywhere.
How to use
- Paste your JSON into the left editor, or click Paste to read it from the clipboard.
- Pick an indentation (2 spaces, 4 spaces or tabs) and click Format to pretty-print it into the right-hand editor.
- Use Minify to collapse JSON onto a single line — handy for environment variables, curl commands and request bodies.
- Use A↑ / Z↓ to sort every object key alphabetically, which makes two large documents much easier to compare.
- If the JSON is broken (trailing commas, single quotes, unquoted keys), click Repair to fix the most common mistakes automatically.
- Switch on Tree to browse the document as a collapsible tree, or Visualize to see its structure as a diagram.
Example
Minified input like this:
{"id":42,"name":"Alice","roles":["admin","editor"],"active":true}becomes:
{
"id": 42,
"name": "Alice",
"roles": [
"admin",
"editor"
],
"active": true
}Common JSON errors the validator catches
- Trailing commas after the last item in an object or array — allowed in JavaScript, not in JSON.
- Single-quoted strings — JSON strings must use double quotes.
- Unquoted keys such as {name: "x"} — every key must be a quoted string.
- Comments (// or /* */) — standard JSON has no comment syntax.
- NaN, Infinity or undefined — these are not valid JSON values; use null or a number instead.
Frequently asked questions
- Does formatting change my data?
- No. Formatting and minifying only change whitespace. Values, key order and structure are untouched unless you explicitly sort the keys or run Repair.
- How large a file can I format?
- The editor comfortably handles files of several megabytes. Because processing is local, the practical limit is your browser’s memory rather than an upload limit.
- What is the difference between JSON and a JavaScript object?
- JSON is a strict text format derived from JavaScript object syntax. It requires double-quoted keys and strings, and does not allow comments, trailing commas, functions or undefined.
Privacy
This tool runs entirely in your browser. The data you paste or open is processed locally and is never uploaded to or stored on our servers.