How to format and validate JSON
- Paste your JSON into the input box, for example an API response or a config file.
- Choose the indentation and whether to sort keys, then press Format.
- If the JSON is invalid, the error shows the exact line and column. Fix it and format again.
- Use Minify to get the smallest version for requests or environment variables.
Common JSON mistakes
- Trailing commas:
{"a": 1,}is invalid; remove the last comma. - Single quotes: strings and keys must use double quotes:
{"name": "x"}. - Comments: standard JSON has no comments. Use JSONC or YAML if you need them.
- Special values:
NaN,Infinityandundefinedare not valid JSON values.
When to use JSON vs YAML
JSON is the standard for APIs and data exchange because every language can parse it quickly and the rules are strict. YAML is friendlier for hand-edited configuration such as Kubernetes manifests and GitHub Actions workflows, but its indentation rules cause subtle bugs. Many teams write YAML and validate the result as JSON in CI.