JSON Formatter & Validator
Format, validate or minify JSON. Errors give the line, column and how to fix them.
RFC 8259Strict JSON · limit 10 MB · numbers and key order kept exactly
Runs in your browser. Nothing you enter is sent anywhere. How to check
1.How to use
- Paste your JSON. It is checked and formatted as you type.
- Read the result. Valid JSON shows "Valid JSON" with the line count. Invalid JSON shows the first error with its line, column and a fix; Go to error puts the cursor on it.
- Copy the result, or download it as
formatted.jsonorminified.json.
The tool is also a validator: if the output appears, the input is valid JSON. Inputs over 1 MB are processed when you press Format or Ctrl+Enter.
2.Examples
A minified API response
This input on one line:
{"id":4021,"name":"orders-api","regions":["eu-west-1","us-east-1"],"limits":{"rps":250,"burst":null},"active":true,"tags":[]}formats with 2-space indentation to:
{
"id": 4021,
"name": "orders-api",
"regions": [
"eu-west-1",
"us-east-1"
],
"limits": {
"rps": 250,
"burst": null
},
"active": true,
"tags": []
}Common mistakes and their messages
[1, 2, ]: "Trailing comma at line 1, column 6. Remove the comma after the last item."{'a': 1}: "Strings must use double quotes at line 1, column 2. Replace ' with "."{a: 1}: "Object keys must be in double quotes at line 1, column 2."{"a": 1} // x: "Comments are not allowed in JSON at line 1, column 10. Remove the comment."[NaN]: "Unexpected character 'N' at line 1, column 2."
3.Options explained
Format or Minify
Format puts each key-value pair and each array item on its own line, indented by depth. Empty objects and arrays stay as {} and [].Minify removes all whitespace outside strings, which gives the smallest valid file.
Indentation
Choose 2 spaces, 4 spaces or a tab per level. It applies to Format only. 2 spaces is the most common choice in JavaScript projects; some style guides prefer 4.
4.Limits
- Input up to 10 MB. Above 1 MB, press Format instead of the automatic run.
- Up to 1,000 levels of nested objects and arrays.
- Strict JSON only, as defined by RFC 8259: no comments, no trailing commas, no single quotes, no
NaNorInfinity. - Only the first error is reported. Fix it to see the next one.
5.FAQ
Why is my JSON invalid?
The most common causes are a comma after the last item, single quotes instead of double quotes, keys without quotes, and comments. These are allowed in JavaScript but not in JSON. The error message names the problem and its position.
Does formatting change my data?
No. Only whitespace outside strings changes. Key order, duplicate keys, string escapes such as é, and numbers such as 1.0 or12345678901234567890 are kept exactly as written. A formatter that converts numbers to JavaScript numbers loses digits beyond 253; this one never converts them.
What about JSON with comments (JSONC)?
Files such as VS Code settings and tsconfig.json allow comments and trailing commas. This tool checks strict JSON, so it reports them as errors. Remove them to get standard JSON that every parser accepts.
What if a key appears twice?
The JSON is still valid, so both entries are kept and the status warns about the first repeated key. Most parsers keep only the last value, so a duplicate is usually a mistake (RFC 8259 §4).
Is my data uploaded?
No. Formatting and validation run in your browser. The privacy page shows how to confirm this in your browser's Network tab.