JSON formatter
Format, validate, and minify JSON data
JSON Formatter
Format, validate and minify JSON data
TL;DR
What is JSON formatter?
JSON (JavaScript Object Notation) is a lightweight text format for representing structured data as key-value pairs, arrays, and nested objects. Defined in RFC 8259, it is the dominant data interchange format for web APIs and configuration files.
Common use cases
- ‣API debugging: format a raw API response to inspect its structure during development
- ‣Payload optimization: minify JSON before embedding it in a production build to reduce bytes sent over the network
- ‣Validation: confirm that a string is syntactically valid JSON before passing it to a parser
- ‣Comparison: format two JSON blobs consistently before running a diff to remove formatting noise
Frequently asked questions
What is the difference between formatted and minified JSON?
Formatted JSON adds indentation and line breaks to make it human-readable. Minified JSON removes all unnecessary whitespace to reduce file size. Both represent identical data and parse to the same result.
Why does JSON not support comments?
JSON was designed as a pure data interchange format, not a configuration language. Comments were intentionally excluded to keep parsing unambiguous and simple. If you need inline documentation, use JSONC (JSON with Comments, supported by VS Code and TypeScript configs) or YAML.
What is the difference between JSON and JSON5?
JSON5 is a superset of JSON that allows comments, trailing commas, unquoted keys, and single-quoted strings. It is not an IETF standard and is not accepted by most APIs, but is used in some tooling configuration files such as Babel and some Webpack configs.
See also
- ‣JSON diff: compare two formatted JSON objects to find exactly which keys were added, removed, or changed
- ‣YAML to JSON converter: convert a YAML configuration file to JSON first, then format and inspect it here
- ‣JWT decoder: JWT payloads are JSON objects. Decode a token to extract the raw JSON you can then inspect and format