How it works
The tool reads your JSON one token at a time (braces, brackets, strings, numbers, true, false and null), checks each one against the JSON grammar defined in RFC 8259, and writes the same tokens back out with new whitespace. Nothing is converted to JavaScript values and back, so the output contains exactly the data you put in.
That matters more than it sounds. Many formatters run JSON.parse and then JSON.stringify, which silently changes data: integers larger than 9,007,199,254,740,991 lose digits (an ID such as 12345678901234567890 becomes 12345678901234567000), duplicate keys are reduced to one, and escapes such as \u00e9 are rewritten. This formatter keeps all of them as written.
Rules this tool follows
- Valid JSON uses double-quoted strings and keys, no comments, no trailing commas, and only the literals
true,falseandnull. - Numbers may not have leading zeros, a leading
+or., a trailing., or beNaNorInfinity. - Strings may not contain unescaped line breaks or tabs; use
\nand\t. - A document is exactly one value. It may be an object, an array or a single string, number or literal.
- An invisible byte order mark at the start is removed and reported.
- Key order and duplicate keys are kept; the tool does not sort keys.
Example
Input
{"name":"TexaDocBase","tags":["text","privacy"],"active":true}Output
{
"name": "TexaDocBase",
"tags": [
"text",
"privacy"
],
"active": true
}Common uses
- Reading API responses, configuration files and log entries.
- Finding the missing comma or stray quote that makes a file invalid.
- Minifying JSON before embedding it in a request or a web page.
Limitations and notes
- Only strict JSON is accepted. JSON5, JSONC (JSON with comments) and JavaScript object literals are reported as errors, because many programs that read JSON would reject them too.
- Duplicate keys are valid JSON syntax but are handled differently by different programs; most keep only the last value. The formatter keeps both so you can see them.
- Very large documents (several megabytes) can take a moment to format on slower devices.
Questions
Is my JSON uploaded anywhere?
No. Validation and formatting run entirely in your browser, which makes the tool suitable for configuration files and API responses that should stay private.
Why does it say my JSON with comments is invalid?
The JSON standard does not allow comments. Some tools, such as editor settings files, accept a JSON variant with comments, but standard parsers reject it. Remove the comments, or keep them only in files read by a tool that supports them.