JSON Formatter
Format and validate JSON
Configure
Options
About this tool
Format and validate JSON
Parse valid JSON and rewrite its indentation
JSON Formatter sends the pasted text to the tool service, parses it as JSON, and serializes the same values with the selected indentation. Formatting changes whitespace and line breaks; it does not rename keys, sort fields, or transform values.
Use formatting to inspect structure
- •Expand a minified API response for debugging.
- •Check whether copied configuration is valid JSON.
- •Make nested objects and arrays easier to review in a code diff.
How to use this tool
- 1.Paste JSON without passwords, tokens, private keys, or sensitive records.
- 2.Choose an indentation size; 2 spaces is the default.
- 3.Format the input, review any parse error, then copy or download the result.
JSON rules enforced by the parser
- Object keys and string values require double quotes.
- Trailing commas, comments, single-quoted strings, undefined, and unquoted keys are invalid JSON.
- The server uses JSON.parse followed by JSON.stringify with the requested indent.
Example: expose a nested API response
Input `{"user":{"id":42,"active":true},"roles":["editor"]}` becomes multiple indented lines. The number 42 remains a number, true remains a boolean, and array order is unchanged.
Formatting is not validation of meaning
- Syntactically valid JSON can still violate an API schema or contain incorrect data.
- The formatter does not repair malformed JSON automatically.
- Very large input can exceed browser, request, or server processing limits.
Fix common parse errors
- Unexpected token near a key: replace single quotes with double quotes and quote the key.
- Error near a closing bracket: remove a trailing comma or find a missing value.
- Unexpected end of input: close every object brace and array bracket.
Continue the workflow
Return to Code tools, or continue with a complementary tool:
Questions about this specific tool
Does formatting change JSON values?
No. It parses and serializes the same JSON-compatible values while changing whitespace and indentation.
Why are comments rejected?
Comments are not part of the JSON standard accepted by JSON.parse.
Can it repair invalid JSON?
No. Correct quotes, commas, brackets, and values in the input, then run the formatter again.
Is the JSON processed in my browser?
No. The page sends input to the server-side code-tool API. Do not submit secrets or sensitive records.