JSON Formatter & Validator
Format, validate, minify, and inspect JSON — all in your browser.
Common JSON errors and how to fix them
| Error pattern | Problem | Fix |
|---|---|---|
| {"key": "value",} | Trailing comma after last item | Remove the comma before the closing brace or bracket |
| {'key': 'value'} | Single quotes instead of double quotes | Replace all single quotes with double quotes around keys and string values |
| {key: "value"} | Unquoted key | Wrap the key in double quotes: {"key": "value"} |
| // comment | Comments not supported in JSON | Remove all comments — JSON has no comment syntax |
| undefined, NaN, Infinity | JavaScript-only values not valid in JSON | Replace with null or a valid number |
| {name: undefined} | undefined value | Use null or omit the key entirely |
| "date": 2024-01-01 | Unquoted date string | Wrap in quotes: "date": "2024-01-01" |
JSON data types
JSON supports exactly six data types:
Privacy first: This tool processes everything locally in your browser. Sensitive API keys, tokens, user data, and credentials in your JSON never leave your device. Safe for internal and confidential data.
What each action does
Format (Pretty-print)
Adds consistent indentation and line breaks to make nested JSON human-readable. Choose 2 spaces, 4 spaces, or tabs as the indentation style. Also validates the JSON and reports any errors before formatting.
Minify
Removes all whitespace (spaces, tabs, newlines) that isn't inside a string value. Produces the smallest possible valid JSON string — useful for API payloads, config files shipped with applications, and any situation where file size matters.
Validate only
Checks whether the input is valid JSON without changing it. Reports the exact line and character position of any errors. Useful when you want to confirm correctness without reformatting.
Sort keys
Reformats the JSON with all object keys sorted alphabetically at every level. Useful for comparing two JSON objects, normalising output for version control, or making large objects easier to scan.