What Is JSON?
Learn what JSON (JavaScript Object Notation) is, how it works, its syntax rules, data types, and why it's the most popular data format for web APIs and configuration files.
JSON (JavaScript Object Notation) is a lightweight, text-based data interchange format. Despite its name, JSON is language-independent and supported by virtually every programming language — Python, Java, Go, Rust, C#, Ruby, PHP, and dozens more.
JSON Syntax
A JSON document is built from two structures:
Objects — Unordered collections of key-value pairs wrapped in curly braces `{}`
Arrays — Ordered lists of values wrapped in square brackets `[]`
{
"name": "Alice",
"age": 28,
"isActive": true,
"skills": ["TypeScript", "Go", "Rust"],
"address": {
"city": "San Francisco",
"zip": "94110"
}
}JSON Data Types
JSON supports exactly six data types:
| Type | Example | Notes |
|---|---|---|
| String | "hello" | Must use double quotes |
| Number | 42, 3.14 | No leading zeros, no hex/octal |
| Boolean | true, false | Lowercase only |
| Null | null | Represents absence of value |
| Object | {"key": "value"} | Keys must be double-quoted strings |
| Array | [1, 2, 3] | Can contain mixed types |
Where Is JSON Used?
REST APIs — The default response format for 95%+ of web APIs
Configuration files — `package.json`, `tsconfig.json`, VS Code settings
NoSQL databases — MongoDB, CouchDB, Firebase store data as JSON documents
Message queues — Kafka, RabbitMQ, SQS payloads are typically JSON
Logging — Structured logging with JSON (ELK Stack, CloudWatch, Datadog)
JSON vs XML
JSON replaced XML as the dominant data interchange format because it's more concise, easier to read, and natively supported by JavaScript. An equivalent XML document is typically 2-3x larger than its JSON counterpart.
Try It Yourself
Use our JSON Formatter to beautify and validate JSON instantly, or our JSON Viewer to explore nested structures as a collapsible tree.
Related Tools
Written by JSON Studio
Engineering Team