JSON FORMATTER
Validate and pretty-print JSON instantly. RFC 8259 compliant. Minify mode included. Runs entirely in your browser — no data stored.
Paste any JSON — or upload a .json file. Ctrl+Enter to format.
Complete the verification above to enable the formatter.
JSON Quick Reference
Valid JSON Data Types
string"hello world"number42 or 3.14booleantrue or falsenullnullobject{"key": "value"}array[1, 2, 3]Most Common JSON Errors
{"a":1, "b":2,} — remove the last comma
{'key':'value'} — must use double quotes
{key: "value"} — keys must be quoted
// or /* */ — JSON has no comment syntax
What is JSON?
JSON (JavaScript Object Notation) is a lightweight, text-based data interchange format defined by RFC 8259. Despite its name, JSON is language-independent and is used by virtually every modern programming language — Python, Java, Go, PHP, Ruby, and hundreds of others.
JSON was originally derived from JavaScript object syntax by Douglas Crockford in the early 2000s and became the dominant alternative to XML for API responses, configuration files, and data storage. Its simplicity — just six data types and two structures (objects and arrays) — made it universally readable by both humans and machines.
Why pretty-print JSON?
Raw JSON from APIs typically arrives as a single minified line with no whitespace. This is efficient for data transfer but impossible to read or debug. Pretty-printing adds indentation and newlines to make the structure immediately visible — especially useful when working with deeply nested responses from REST APIs or GraphQL queries.
Pretty Print vs. Minify
Pretty Print adds 4-space indentation and newlines at every nesting level. The result is human-readable in any text editor, diff tool, or documentation system. This is the standard format for config files (like package.json), API documentation, and code review.
Minify strips all whitespace, reducing the JSON to the smallest valid representation. This reduces payload size for API responses and stored data. A 10KB pretty-printed JSON file typically minifies to 3–4KB — a meaningful saving at scale when serving millions of requests.
When to Use a JSON Formatter
Debugging API Responses
When a REST API or webhook returns a minified JSON payload, paste it here to instantly see the structure. Identify missing fields, unexpected null values, or incorrect nesting in seconds rather than minutes.
Validating Config Files
JSON is used for configuration in countless tools — package.json, tsconfig.json, ESLint, Prettier, and more. A single misplaced comma breaks everything. Validate before you push.
Code Review Preparation
Before adding JSON to documentation, a README, or a pull request, run it through the formatter to ensure consistent indentation. Most teams enforce 4-space JSON formatting in code review — this tool produces exactly that.
Optimising API Payloads
Use Minify mode to strip whitespace before storing JSON in a database or transmitting it in an API response. Smaller payloads mean faster responses, lower bandwidth costs, and better mobile performance.
RFC 8259 — The JSON Standard
RFC 8259, published by the IETF in 2017, is the authoritative definition of the JSON format. It supersedes RFC 7159 and RFC 4627. Our formatter validates JSON strictly against this standard using the browser's native JSON.parse() implementation, which itself implements RFC 8259 in all modern browsers (Chrome, Firefox, Safari, Edge).
Key RFC 8259 Rules
- All strings must use double quotes — not single
- Object keys must be quoted strings
- No trailing commas after last element
- No comments of any kind
- Numbers: no leading zeros, no
NaNorInfinity - Unicode strings must be UTF-8 encoded
JSON5 vs JSON
JSON5 is a superset that adds comments, trailing commas, and single-quoted strings. It is not standard JSON and cannot be parsed by JSON.parse().
This formatter validates against RFC 8259 only. If your input uses JSON5 syntax, it will show an error — you should convert it to standard JSON first.
Frequently Asked Questions
Is my JSON data safe when using this formatter?
What JSON standard does this formatter validate against?
JSON.parse() for validation, which implements RFC 8259 in all modern browsers. JSON5, HJSON, and other supersets are not supported.What is the difference between pretty-print and minify?
Why does my JSON show "INVALID JSON"?
// or /* */ are not valid in JSON), missing commas between elements, or unclosed braces/brackets. The error message shows the exact position of the first syntax problem.Can I format large JSON files?
Why 4-space indentation?
JSON.stringify(obj, null, 4) produces — the exact standard JS API output.