JSON Formatter
Format, validate, and minify JSON
How to Use the JSON Formatter
Paste any JSON string into the input box and click Format to pretty-print it with 2-space indentation, or Minify to strip all whitespace for transmission. Validate checks syntax without changing the content and reports the root type and key count.
Common JSON Pitfalls
- Trailing commas —
{"a": 1,}is invalid JSON even though JavaScript allows it. Use a linter before sending to an API. - Single quotes — JSON requires double quotes for both keys and string values.
{'key': 'val'}will fail to parse. - Numbers as strings — Large integers (over 15 digits) lose precision in JavaScript's
JSON.parse(). Use a BigInt-aware parser if you're working with snowflake IDs. - Unicode escapes — Characters outside Basic Latin should be represented as
\uXXXXin strict JSON, though most parsers handle UTF-8 directly.
Format vs. Validate vs. Minify
Format is for readability during development and debugging. Minify reduces payload size for API requests, config files, or storage where whitespace costs bytes. Validate is the right step before committing a JSON config file or seeding a database: it catches syntax errors without altering your content. All three operations run entirely in your browser — your JSON never leaves your machine.
JSON vs. JSON5
JSON5 is a superset that allows comments, single quotes, trailing commas, and unquoted keys. It is not valid JSON. If you see a .json5 file, you need a JSON5 parser, not a standard JSON.parse() call. This tool validates against the strict JSON spec (RFC 8259).