Formula
parse (strict, RFC 8259) → print with the chosen indentation
- Numbers and strings are copied exactly as written; only whitespace outside strings changes.
Read the document to check it is valid, then write it back out with consistent whitespace.
Worked example
A small object
- JSON
- {"name":"Ada","skills":["math","code"],"score":1.0}
- Indent
- 2 spaces
- Sort keys alphabetically
- No — keep original order
Formatted JSON
Valid — formatted below
Size: 77 bytes
Lines: 8
{
"name": "Ada",
"skills": [
"math",
"code"
],
"score": 1.0
}How it works
The formatter reads your JSON with a strict parser, so anything that isn't valid JSON — a trailing comma, single quotes, an unquoted key, a comment — is reported with its line and column and a plain-English reason, rather than a vague “unexpected token”.
Unlike a round trip through JSON.parse and JSON.stringify, numbers are kept exactly as typed: 1.0 stays 1.0 and an ID such as 12345678901234567890, which JavaScript would silently round, is preserved. Duplicate keys are flagged. For a quick yes/no check use the JSON Validator; to shrink it for transport use the JSON Minifier.
Everything happens on your device. The JSON is never uploaded, stored or sent to analytics, and share links are disabled for this tool so a pasted payload can't end up in a URL.
Assumptions and limits
- Input is limited to 5 MB.
- Comments and trailing commas are not valid JSON and are reported as errors.