JSON Formatter
Format and beautify JSON with readable indentation.
Your result will appear here…
How to use JSON Formatter
- Paste a JSON document, not a JavaScript variable assignment.
- Select Format. If parsing fails, correct the reported syntax error.
- Inspect the indentation and copy the result.
Example
Input / settings:
{"user":{"id":7,"active":true}}Output:
{
"user": {
"id": 7,
"active": true
}
}When to use
- Inspect a nested API response.
- Prepare a readable configuration for review.
- Locate a misplaced array or object boundary.
Overview
JSON represents objects, arrays, strings, numbers, booleans, and null. This formatter parses JSON and serializes it with two-space indentation so nested API responses are easier to inspect.
Supported input
One complete JSON value: an object, array, string, number, boolean, or null. Comments and trailing commas are rejected.
Output details
JSON serialized with two-space indentation after parsing with JavaScript JSON.parse.
Limitations
- Formatting checks syntax, not a JSON Schema or application rules. It does not repair invalid JSON.
- Parsing and serialization can change number precision, duplicate keys, and integer-like property ordering. Keep large identifiers as strings.
Common mistakes
- Trailing commas and single-quoted keys are not JSON.
- Literal line breaks inside strings must be escaped as \n.
- Closing an array with } instead of ] causes a parse error.
Practical tips
- Formatting does not validate an API schema or repair malformed data.
- Keep identifiers larger than JavaScript's safe integer range as strings: parsing and serializing numbers can change precision.
Privacy and security
This tool runs entirely in your browser. Your input is never uploaded to our servers. Formatting runs locally. Use redacted examples when sharing the formatted result; indentation does not remove secrets.
References
Frequently asked questions
Will it repair invalid JSON?
No. Fix the syntax first; the formatter does not guess missing values or punctuation.
Are comments preserved?
No. JSON does not accept comments, so a document containing them is rejected.
Does formatting sort keys?
It does not deliberately sort keys. JavaScript serialization can reorder integer-like property names.