What is JSON?
JSON (JavaScript Object Notation) is a lightweight data format used to store and exchange structured data. Learn what JSON is, how it works, and when to use it.
JSON is a lightweight, text-based data format used to store and transfer structured data between a server and a client. Despite its name, JSON is language-independent and widely used across all programming languages.
JSON Syntax
JSON is built on two structures: • Objects: key-value pairs wrapped in curly braces { } • Arrays: ordered lists of values wrapped in square brackets [ ] Example: { "name": "Alice", "age": 30, "hobbies": ["reading", "coding"] }
JSON Data Types
JSON supports 6 data types: • String — "hello" • Number — 42, 3.14 • Boolean — true, false • Null — null • Object — { "key": "value" } • Array — [1, 2, 3]
Where is JSON Used?
JSON is the dominant format for web APIs. When you open a web app and it loads your profile, weather data, or social feed — that data is almost certainly transferred as JSON. It's also used for configuration files (package.json, tsconfig.json) and databases like MongoDB.
Try it yourself
Format & Validate JSONAbout JSON
JSON was derived from JavaScript but is now a language-independent standard (ECMA-404). It replaced XML as the preferred data interchange format on the web because it is simpler to read and write.
FAQ
- What does JSON stand for?
- JSON stands for JavaScript Object Notation.
- Is JSON the same as JavaScript?
- No. JSON is a data format inspired by JavaScript object syntax, but it is language-independent. It can be used with Python, Java, Ruby, and virtually any programming language.
- What is the difference between JSON and XML?
- Both are data formats, but JSON is lighter, easier to read, and faster to parse. XML uses verbose tags while JSON uses concise key-value pairs.