What is JSON? A Practical Format Guide
Most payloads show up as one line. Learn the actual JSON grammar first, then expand the tree in the browser instead of guessing keys from a dump.
What is JSON?
JSON (JavaScript Object Notation) is a text format for structured data. It is not a programming language and not a database. It only says how to write objects, arrays, strings, numbers, booleans, and null. HTTP APIs, config files, and log payloads use it because humans can read it and every major language can parse it.
A typical document is rooted at an object {...} or an array [...]. Object keys must be double-quoted strings. Values may be strings, numbers, true/false, null, nested objects, or arrays. Arrays are ordered; mixed types are legal but APIs usually keep a stable shape so you can generate types.
JSON looks like a JavaScript literal and is stricter: quoted keys, no comments, no trailing commas, no NaN or undefined. {name: Ada,} is not JSON. Use the JSON formatter when you need to expand or minify; counting braces by eye does not scale.
Why do we use JSON?
Services exchange fields and nesting, not in-memory layouts. JSON is the contract as text: Go unmarshals into structs, TypeScript emits interfaces, Python gets dicts. You can change the language without changing the payload format.
It is lighter than XML: no matching tags, a small type set, parsers everywhere. The tradeoff is no built-in schema. Names and optionality live in docs, OpenAPI, or a JSON Schema file.
The debugging pain is rarely “how do I spell JSON”. It is a minified Network panel or a log line with extra escaping. If you cannot see the tree, you cannot match fields. Format first, then debug the product.
How to work with JSON
Start from the root: object or array. Paths like user.id only work on objects; arrays need an index. Strings always use double quotes. Do not quote numbers unless the contract truly wants a string (snowflake IDs often should be strings).
Prefer copying a real response, then editing. Hand-written JSON picks up single quotes, missing commas, and trailing commas. Run the JSON validator for syntax only—it will not tell you a business field is missing.
Pretty-print when a human needs the tree; minify when you paste into a request body or a log line. Both live on the same formatter page. JSON text is Unicode; that is unrelated to Base64, which exists to carry bytes on a text channel.
What usually fails to parse
Trailing commas and comments often survive in JavaScript objects and die in strict JSON. Stripping // and the last extra comma fixes a large share of “it works in the console” samples.
IEEE 754 cannot hold every integer above 2^53-1. Large IDs should travel as strings. Booleans are lowercase true/false.
If pretty-print fails, stop clicking it. Read the error, then validate. For a method-by-method walkthrough see how to format JSON. More converters sit on the JSON tools hub.
Related tools
FAQ
Is JSON the same as a JavaScript object?
No. JSON is text with stricter rules. A JS object is in memory and must be serialized to become JSON.
Can a JSON document be a bare string or number?
The RFC allows a JSON text to be any value. APIs almost always send an object or array, and our formatter follows that habit.
Why does it run in the browser but fail validation?
The page may parse JavaScript, which allows trailing commas or single quotes. Request bodies are usually strict JSON.
How do I write non-ASCII text?
UTF-8 in the string is fine, or `\uXXXX` escapes. Do not double-escape.
Which tool should I open next?
Formatter to see structure; validator to ask “is this JSON at all?”. Codegen tools if you still need types.