Skip to content

JSON

In one line

JSON (JavaScript Object Notation) is a lightweight text format for storing and exchanging data, based on JavaScript object syntax.

In simple words

JSON is a text-based data format that looks like JavaScript object literals but with strict rules: keys must be in double quotes, no trailing commas, no functions, no undefined, and only primitive values (string, number, boolean, null) plus arrays and objects.

JavaScript provides JSON.parse() (convert a JSON string to a JavaScript value) and JSON.stringify() (convert a JavaScript value to a JSON string). These are used for saving data to localStorage, sending data to/from servers, and configuration files.

JSON is language-independent — it is used by virtually all programming languages, not just JavaScript. It is the most common format for API responses (REST APIs) and configuration files.

Example

javascript
const obj = { name: "Ada", age: 36 };
const json = JSON.stringify(obj);
console.log(json); // '{"name":"Ada","age":36}'
const parsed = JSON.parse(json);
console.log(parsed.name); // "Ada"

JSON.stringify converts to JSON text; JSON.parse converts back to a JavaScript object.

Related terms

Related Resources

Related Lessons

Related Tools

Decode error messages

Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.

View errors

← Back to glossary