JSON Formatter
Format, minify, and inspect JSON in your browser with Editor, Tree, Table, and Types views. The parser accepts some common repairs, but other syntax errors remain visible in the output.
How to format JSON
- Paste or load it: paste JSON into Input JSON, choose Upload for a
.jsonor.txtfile, or choose URL to have your browser request JSON from a URL. - Choose the operation: Beautify adds line breaks and indentation. Minify serializes the parsed value without formatting whitespace.
- Choose indentation: open Indent: 2 and choose 2 Spaces, 4 Spaces, 8 Spaces, or Tab. The setting affects Beautify output; Minify remains one compact line.
- Inspect and save: use Editor, Tree, Table, or Types on the output side, then use its Copy or Download icon.

Examples
Minified API response to readable JSON
Paste this 103-byte response and choose Beautify with two spaces:
{"user":{"id":42,"active":true},"items":[{"sku":"A-17","qty":2},{"sku":"B-04","qty":1}],"note":"ready"}{
"user": {
"id": 42,
"active": true
},
"items": [
{
"sku": "A-17",
"qty": 2
},
{
"sku": "B-04",
"qty": 1
}
],
"note": "ready"
}Trailing commas and single quotes
{'name':'Ada', 'items':[1,2,],} is not strict JSON, but this formatter's repair fallback removes the trailing commas and changes single quotes before parsing. It therefore shows the repaired object and does not show an error message or line/column for this input. For portable JSON, write "name":"Ada", use double-quoted keys and strings, and remove the trailing commas.
For a syntax error the repair fallback cannot fix, the tool displays the parser message. With {"name":"Ada"
"role":"admin"}, the tested output begins: Invalid JSON: Expected ',' or '}' after property value in JSON at position 15 (line 2 column 2). Add the missing comma after "Ada".
Minify before and after
The formatted example above is 186 UTF-8 bytes. The formatter's Minify output is 103 bytes, saving 83 bytes (44.6%). The count is for this exact sample, not a promised saving for every JSON document.
Common JSON errors and how to fix them
| Error | Typical cause | Fix |
|---|---|---|
| Trailing comma | Comma before ] or } | Remove it. This tool repairs this case, but strict parsers may reject it. |
| Single quotes | JavaScript-style strings | Use double quotes. This tool's repair fallback accepts simple single-quoted input. |
| Unquoted keys | Object keys copied from JavaScript | Quote every key, such as "name". |
| Comments | Comments such as // or /* */ copied into JSON | Remove comments; the formatter's repair path strips them. |
| NaN, undefined, or Infinity | Values from a programming language | Use null or a quoted value. The repair path changes NaN and undefined values after a colon to null; Infinity is not repaired. |
| Unescaped newline or tab in a string | A literal control character inside quotes | Use \n or \t escapes. |
| Duplicate keys | The same key appears twice | Keep one key. JavaScript parsing in this tool keeps the last value. |
| BOM or invisible characters | Copied file starts with BOM or zero-width characters | Remove them; this tool strips a leading BOM and zero-width characters. |
| Unmatched brackets | Missing or extra ] or } | Balance every array and object delimiter, then format again. |
Format JSON in code
These snippets use the standard formatting APIs and were checked for valid syntax:
// JavaScript
JSON.stringify(obj, null, 2)
# Python
json.dumps(obj, indent=2)
python -m json.tool input.json
# jq
jq . input.json
// Go
json.MarshalIndent(value, "", " ")For a strict syntax check before formatting, use the JSON Validator. After formatting, the JSON Editor Tree View is better suited to editing values.
What the formatter changes and what it doesn't
Beautify changes whitespace between JSON tokens. Minify removes that presentation whitespace. In tested runs, object key order stayed in its input order, duplicate keys collapsed to the last value, and 9007199254740993 became 9007199254740992 because the browser parses numbers as JavaScript numbers. An escaped \u00e9 was emitted as é, while two spaces and a newline escape inside a string remained part of the string. Do not use this tool as a lossless transport for integers beyond JavaScript's exact-number range.
Formatting does not turn JSON into YAML or edit values intentionally. For conversions, use JSON to CSV or JSON to XML; to inspect a changed payload, use the Diff Checker.
Privacy
Parsing, repair, formatting, and minifying happen in your browser in this page's JavaScript. Your pasted JSON is never sent to our servers by the formatter. If you use the URL option, your browser requests that URL directly and the response is then placed into the tool; that request is separate from sending data to T00LZ. Files are read with the browser's FileReader and are not uploaded by this tool.
Limits
There is no application-defined byte limit in the formatter code: uploads are read with FileReader, and pasted text is held in React state. Processing time and memory depend on the browser, device, and document shape. The page does not promise a maximum file size, so test larger files with care.
FAQ
Is my JSON uploaded anywhere?
Normal paste, upload, Beautify, Minify, and view operations run in the browser. The formatter does not send that JSON to T00LZ servers. The exception is the URL button: your browser makes a direct request to the address you enter, subject to that server's response and browser security rules. Treat third-party URLs as external requests.
Why do I get “Unexpected token”?
Error wording varies by browser: Chrome, Firefox, and Safari may describe the same invalid JSON differently. One tested Chrome example is “Invalid JSON: Expected ',' or '}' after property value in JSON at position 15 (line 2 column 2)” for a missing comma between two properties. Look near the reported position for a missing comma, unmatched bracket, or control character. This tool repairs some common cases before reporting an error.
Is this a formatter, validator, or minifier?
It does all three in one workflow, with an important distinction: Beautify and Minify first parse the input, and the tool displays an error when parsing still fails. It is not a schema validator, so it does not check whether your JSON matches an API schema or required business fields. Use the JSON Validator link above for a dedicated syntax-checking workflow.
Does formatting change my data?
It changes whitespace outside strings and serializes the parsed JavaScript value. It does not intentionally edit ordinary strings, booleans, or nulls. Parsing can matter: duplicate keys keep the last value, large numbers can lose precision, and escaped Unicode may be emitted as a literal character. Review sensitive numeric data before using the result.
How big a file can I paste?
The formatter has no hardcoded file-size cap. The editor, parsed object, and formatted string all consume browser memory, so available RAM and document shape determine practical limits. For a large document, try a smaller sample first and use the Download control for the resulting JSON.
Should I use 2 spaces, 4 spaces, 8 spaces, or tabs?
Choose the convention required by the project receiving the JSON. This tool offers 2, 4, and 8 spaces plus Tab under the Indent control. The choice affects readability and the byte size of Beautify output; it does not change the parsed values. Minify ignores the indentation setting and emits compact JSON.
Related JSON tools
- JSON Validator checks syntax before formatting.
- JSON Editor Tree View lets you edit after formatting.
- JSON to CSV converts tabular formatted output.
- JSON to XML converts the formatted structure for XML workflows.
- Diff Checker compares JSON before and after a change.
- Base64 Encode/Decode helps inspect encoded JWT or payload parts.
Last updated: · About T00LZ