Indent:

Input — paste your JSON

Output

All formatting is done in your browser. No data is sent to any server.

How JSON Formatting Works

JSON (JavaScript Object Notation) is a lightweight data format used by virtually every web API, configuration file, and database. Raw JSON from an API response is often minified — all whitespace stripped to reduce file size. This makes it unreadable to humans. A JSON formatter adds consistent indentation and line breaks, turning a compressed blob into a structured, readable document.

Worked Example

The same data, minified vs. formatted:

Minified (hard to read)

{"user":{"name":"Alice","age":30,"roles":["admin","editor"]}}

Formatted (easy to read)

{
  "user": {
    "name": "Alice",
    "age": 30,
    "roles": [
      "admin",
      "editor"
    ]
  }
}

Format vs. Minify vs. Validate

Format adds indentation and line breaks for readability — use this when debugging API responses or reading config files. Minify removes all whitespace to produce the smallest possible JSON string — use this before sending data over a network or storing in a database. Validate checks whether your JSON is syntactically correct without modifying it — use this when you get a parse error and need to find the problem. If your JSON contains Base64-encoded fields, use our Base64 Decoder to inspect those values. For URL-encoded query strings embedded in JSON, our URL Decoder handles those.

Common JSON Errors

The validator in this tool reports the exact line and position of any error. The most common JSON mistakes are: trailing commas after the last item in an object or array (valid in JavaScript but not in JSON), using single quotes instead of double quotes for strings, forgetting to quote object keys, and including comments (JSON has no comment syntax — use JSON5 or JSONC if you need comments in config files).


Frequently Asked Questions

What is the difference between JSON formatting and JSON validation?
Formatting adds indentation and line breaks to make JSON readable — it does not check whether the JSON is valid. Validation checks the syntax against the JSON specification and reports errors. This tool does both: it validates first, then formats if the input is valid. If your JSON is invalid, the error message tells you exactly where the problem is.
Does this tool send my JSON data to a server?
No. All formatting, minifying, and validation runs entirely in your browser using JavaScript's built-in JSON.parse() and JSON.stringify() functions. No data is transmitted anywhere. This makes it safe to use with API keys, authentication tokens, personal data, or any other sensitive JSON content.
What causes "unexpected token" errors in JSON?
The most common causes are: trailing commas after the last item in an object or array ({"a":1,} is invalid), single quotes instead of double quotes ({'key':'value'} is invalid), unquoted keys ({key:"value"} is invalid), and comments (// comment is not valid JSON). The error message from this tool includes a line number to help you locate the problem quickly.
What is the difference between JSON beautify and JSON minify?
Beautify (format) adds whitespace — indentation and line breaks — to make JSON human-readable. Minify removes all unnecessary whitespace to produce the smallest possible string. Beautified JSON is easier to read and debug. Minified JSON is smaller to transmit over a network and faster to parse. Both are valid JSON — the data content is identical.
Can I format JSON with comments?
No. Standard JSON (RFC 8259) does not support comments. If you try to format JSON that contains // or /* */ comments, the validator will report a syntax error. If you need comments in configuration files, consider using JSON5 or JSONC formats instead — these are supersets of JSON that allow comments, but they require a specific parser and are not interchangeable with standard JSON.
How do I format large JSON files without slowing my browser?
This tool processes JSON entirely in memory in your browser. For files up to a few megabytes, it runs instantly. Very large JSON files (50 MB+) may cause a brief pause depending on your device. If you regularly work with very large JSON payloads, consider using a local tool like jq in the terminal, which processes files of any size efficiently without loading them into a browser.