Understand this tool
Format JSON safely and clearly
- What the concept means
- JSON is a language-independent text format for structured values: objects, arrays, strings, numbers, booleans, and null.
- Why it exists
- Formatting adds insignificant whitespace for reading; minifying removes it for compact transfer without changing the data model.
- When to use it
- Use it to inspect and normalize non-sensitive JSON text locally.
- What the result means—and does not mean
- A successful parse proves syntactic JSON only. It does not validate an application schema, business rules, authenticity, or whether numeric precision survives another system.
From JavaScript notation to an interchange standard
JSON’s syntax was drawn from JavaScript object-literal notation and was promoted as a simple data-interchange format by Douglas Crockford in the early 2000s. It is now defined independently by ECMA-404 and RFC 8259.
A JSON object is text data, not a live JavaScript object. JSON has no comments, functions, undefined value, date type, or arbitrary executable expressions. Object member order is often preserved by software but generally should not carry meaning.
Whitespace changes presentation, not values
Spaces, tabs, and line breaks outside strings are insignificant. Formatting parses then serializes with indentation; minifying serializes without optional whitespace. Escape sequences and number formatting may be normalized in the process.
Key concepts
Key concepts
- JSON
- A standardized text syntax for structured data interchange.
- JSON object
- An unordered collection of string-named members.
- JSON array
- An ordered sequence of values.
- Serialization
- Converting an in-memory value to a transportable representation.
- Pretty-printing
- Adding whitespace and indentation for readability.
- Minification
- Removing optional whitespace.
Method or process
How the process works
Whitespace changes presentation, not values
Spaces, tabs, and line breaks outside strings are insignificant. Formatting parses then serializes with indentation; minifying serializes without optional whitespace. Escape sequences and number formatting may be normalized in the process.
Compare the concepts
JSON text and a JavaScript object
| Feature | JSON | JavaScript object |
|---|---|---|
| Form | Text syntax | Runtime value |
| Allowed values | Six JSON value types | Functions, undefined, symbols, and more |
| Comments | Not allowed | Possible in source code |
Common mistakes
Common mistakes
- Assuming valid JSON satisfies an application schema.
- Using single quotes or trailing commas.
- Treating member order as semantic.
Edge cases and limits
Edge cases and limits
- Duplicate member names are handled inconsistently.
- Large integers may lose precision in JavaScript.
- A top-level JSON value need not be an object.