What JSON is, its basic structure, common syntax mistakes, and why formatting makes it readable.
JSON (JavaScript Object Notation) is the format most web APIs use to send structured data back and forth - when an app fetches a profile, a weather forecast or a list of products, the response is very often JSON. It's also commonly used for configuration files because it's simple enough for both humans and programs to read.
JSON is built from a small set of pieces: objects (curly braces {}, holding key-value pairs), arrays (square brackets [], holding an ordered list), strings (always in double quotes), numbers, true/false, and null. An object might look like {"name": "Ana", "age": 29, "active": true} - the key is always a quoted string, and the value can be any of the other types, including a nested object or array.
JSON is stricter than it looks. A trailing comma after the last item is invalid, keys must use double quotes (not single quotes, and not left unquoted), and JSON has no support for comments. These are the most frequent reasons a JSON parser rejects otherwise reasonable-looking data.
APIs typically return JSON with no extra whitespace to save bandwidth, which produces a single dense, unreadable line for anything beyond a tiny object. Formatting - adding consistent indentation and line breaks - doesn't change the data at all, it just makes the structure visible to a human.
If you're not sure whether a piece of JSON is valid, the fastest check is trying to parse it: if parsing fails, you have a syntax error to fix, and if it succeeds, you know the structure is sound before you rely on it in code.