Aug 6, 2026
5 min read
Every time an app talks to a server — logging in, loading a feed, saving a form — data has to travel somewhere in a format both sides understand. JSON (JavaScript Object Notation) became that universal format because it is lightweight, human-readable, and native to how JavaScript already represents data. Nearly every modern API, config file, and NoSQL database speaks JSON, which is why reading and writing it correctly is a baseline skill for any CS student, not just web developers.
JSON has exactly two structures, and everything else is built from them.
Objects — unordered key-value pairs wrapped in curly braces:
{
"name": "Aditi Sharma",
"year": 2,
"isEnrolled": true
}
Arrays — ordered lists wrapped in square brackets:
{
"courses": ["Data Structures", "Operating Systems", "Databases"]
}
Objects and arrays nest inside each other freely — an array of objects, an object containing arrays, as deep as the data requires.
JSON is strict about what a value can be. Every value must be one of exactly six types:
| Type | Example | Notes |
|---|---|---|
| String | "hello" | Always double quotes — single quotes are invalid |
| Number | 42, 3.14, -7 | No quotes; no leading zeros; no NaN/Infinity |
| Boolean | true, false | Lowercase, unquoted |
| null | null | Lowercase, represents "no value" |
| Object | { "key": "value" } | Nested key-value structure |
| Array | [1, 2, 3] | Nested ordered list |
Anything outside this list — a JavaScript function, a Date object, undefined — is not valid JSON and will fail to parse.
Paste a hand-written JSON blob into the JSON Formatter and it will usually fail on one of these five rules:
{name: "Aditi"} is invalid — it must be {"name": "Aditi"}.["a", "b",] fails — the comma after the last item breaks strict parsers.// this is a note is JavaScript, not JSON. There is no comment syntax in the JSON spec at all.{'name': 'Aditi'} is invalid JSON, even though it's valid JavaScript object syntax.007 and 3. are both invalid; use 7 and 3.0.{
"student": {
"name": "Aditi Sharma",
"gpa": 8.7,
"graduated": false,
"courses": [
{ "code": "CS201", "credits": 4 },
{ "code": "CS305", "credits": 3 }
],
"advisor": null
}
}
This single object demonstrates nesting (an object inside an object), an array of objects, every data type, and correct comma placement — no trailing comma after the last array element or the last key in each object.
Before JSON, XML was the dominant data-interchange format for APIs. The comparison explains why JSON displaced it almost everywhere except legacy enterprise systems:
| JSON | XML | |
|---|---|---|
| Syntax weight | Minimal — braces and colons | Verbose — opening/closing tags for everything |
| Native parsing | Built into JavaScript (JSON.parse) | Requires a dedicated parser library |
| Data types | Explicit (string, number, boolean, null) | Everything is text unless schema-typed |
| Arrays | Native [ ] syntax | No native array — repeated tags simulate it |
| Human readability | High, especially nested data | Lower — tag overhead obscures structure |
XML still has strengths (schemas, namespaces, document markup) that keep it alive in specific domains like enterprise SOAP APIs and configuration formats such as Android layouts — but for REST APIs and general data exchange, JSON's brevity won.
The most common real-world failure is a JSON string that almost parses. A missing comma, an extra brace, or a stray trailing comma anywhere in a large nested object can be genuinely hard to spot by eye. Paste the raw text into the JSON Formatter — it validates the structure, pretty-prints it with proper indentation, and points to exactly where parsing broke, entirely in your browser with nothing sent to a server.
package.json, tsconfig.json, and most modern tool configs are JSON.pandas.read_json() and similar functions are standard ways to load structured data.If you're debugging an assignment where the API response, config file, or database document just won't parse — and the error message isn't telling you where — the programming help service connects you with developers who can trace the exact line breaking your JSON and explain why, not just hand you a fix.
Discuss tutoring, code review, project mentoring, or research-method guidance.