What this JSON tool does
Paste JSON from an API response, a config file or a log line and choose an action:
- Format re-indents the data with 2 spaces, 4 spaces or tabs so nested objects and arrays are readable. Long one-line API responses become easy to scan.
- Minify removes all whitespace, producing the smallest valid representation for storage or transmission. A 12 KB pretty-printed file typically shrinks by 20–40%.
- Validate checks the syntax without changing anything and reports the top-level type and number of keys.
If the input is invalid, the error message includes the line and column where parsing stopped, so you can jump straight to the problem instead of scanning the whole file. The output box is read-only; use Copy to grab it or Download .json to save a file.
Reading the stats line
Under the output you see the size in bytes (UTF-8, the same figure your server or CDN would report), the top-level type (object, array, string, number, boolean or null) and, for objects, the number of keys. For arrays the item count is shown instead. This is handy for checking that an API returned the shape you expected — for example an array of 25 items rather than a single wrapped object.
Common causes of “Invalid JSON”
| Problem | Example | Fix |
|---|---|---|
| Trailing comma | {"a": 1,} |
Remove the comma after the last item |
| Single quotes | {'a': 1} |
Use double quotes for keys and strings |
| Unquoted key | {a: 1} |
Write {"a": 1} |
| Comments | // note or /* … */ |
JSON has no comments; delete them |
undefined or NaN |
{"x": undefined} |
Use null or a number |
| Smart quotes from Word | {“a”: 1} |
Replace with straight quotes " |
| Concatenated objects | {"a":1}{"b":2} |
Wrap them in an array [ … ] |
JavaScript object literals and JSON look similar but are not the same. If you copied code from a .js file, expect several of the issues above.
Example
Input (minified):
{"order":"IN-2031","items":[{"sku":"A1","qty":2},{"sku":"B7","qty":1}],"paid":true}
After Format with 2 spaces:
{
"order": "IN-2031",
"items": [
{
"sku": "A1",
"qty": 2
},
{
"sku": "B7",
"qty": 1
}
],
"paid": true
}
The stats line reads 89 B · top-level type: object · 3 keys.
Tips
- Formatting uses the browser’s native
JSON.parseandJSON.stringify, so the output is exactly what Node.js, Python’sjsonmodule or any other standards-compliant parser would accept. - Very large numbers (more than about 16 significant digits) lose precision in JavaScript. If your data contains 64-bit IDs, expect the last digits to change after formatting; store such IDs as strings.
- Key order is preserved as written, except that integer-like keys such as
"1"are moved first — this is standard JavaScript behaviour. - Use Minify before pasting JSON into a URL parameter, an environment variable or a Kubernetes secret, where line breaks are inconvenient.
- Duplicate keys are legal in the syntax but only the last value is kept, so validate carefully when merging configs.
Frequently asked questions
Is my JSON sent to a server?
No. Parsing and formatting use the browser's built-in JSON engine. Your data stays on your device, so it is safe for API keys and private data.
Why does my JSON show an error?
Common causes are trailing commas, single quotes instead of double quotes, unquoted keys, or comments. JSON does not allow any of these.