JSON
In one line
JSON (JavaScript Object Notation) is a lightweight text format for storing and exchanging structured data.
In simple words
JSON is a text-based data format that is easy for humans to read and for machines to parse. It is the standard data format for web APIs, replacing XML for most use cases. Despite the name, JSON is language-independent — it works with any programming language.
JSON has a simple structure: objects (key-value pairs in curly braces) and arrays (ordered lists in square brackets). Values can be strings (double-quoted), numbers, booleans, null, objects, or arrays. JSON does NOT support undefined, functions, or comments.
In JavaScript, you convert with JSON.stringify(obj) (object → JSON string) and JSON.parse(str) (JSON string → object). All keys must be double-quoted, and strings must use double quotes — single quotes are invalid in JSON.
Example
{
"name": "Ada Lovelace",
"age": 36,
"skills": ["math", "programming"],
"active": true,
"mentor": null
}A JSON object with string, number, array, boolean, and null values. All keys are double-quoted.
Related terms
Related Resources
Related Lessons
- JSON
Learn JSON.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.