About JSON Formatter
What is JSON?
JSON (JavaScript Object Notation) is the default data format for REST APIs, NoSQL databases, and config files. It's built from two structures: objects ({}) with key-value pairs, and arrays ([]) with ordered lists. Values can be strings, numbers, booleans, null, or nested objects/arrays.
The rules are strict: all keys and strings need double quotes, no trailing commas, no comments, no NaN or Infinity. Whitespace is ignored, so format it however you like for readability.
Common JSON Errors
If your JSON isn't parsing, it's almost certainly one of these:
- Trailing commas.
{ "name": "Alice", }is invalid. Drop the final comma. - Unquoted keys. JSON needs
{ "name": "Alice" }, not{ name: "Alice" }. - Single quotes.Only double quotes work. Some parsers are forgiving, but don't rely on it.
- Unescaped control characters. Raw tabs and newlines inside strings break the parser. Use
\t,\n,\r. - Comments. JSON has no comment syntax. Try JSONC, YAML, or TOML if you need them.
How to Use This Tool
Paste your JSON into the input on the left. Format pretty-prints it with your chosen indentation. Minify strips whitespace into a single compact line. Validatechecks syntax without changing anything -- handy when an API payload isn't loading or a config file refuses to parse.
Frequently Asked Questions
Is my data sent to a server?
No. Everything runs in your browser.
What's the difference between formatting and minifying?
Formatting adds indentation for readability. Minifying strips all whitespace to make it compact. Same data, different presentation.
Why does my JSON fail to parse?
Usually a trailing comma, single quotes, unquoted keys, or comments. Hit Validate to find the issue.
Can JSON contain comments?
No. The spec (RFC 8259) doesn't allow them. JSONC does, but standard parsers will choke.
This utility is provided for informational purposes only. KnowKit is not responsible for any errors in the output.