Fundamentals · 8 min read · Updated January 2025
JSON (JavaScript Object Notation) is a lightweight, text-based format for storing and exchanging structured data. Despite its name suggesting a tie to JavaScript, JSON is language-independent and supported by virtually every modern programming language including Python, Java, C#, Go, PHP, and Ruby.
Since its standardization as RFC 8259, JSON has become the dominant format for REST APIs, configuration files, NoSQL databases, and inter-service communication in microservices architectures.
Why JSON Matters
Before JSON gained popularity, XML was the primary data interchange format. JSON replaced XML in many contexts because it is more compact, easier for humans to read, faster to parse, and maps naturally to native data structures in most programming languages.
When you call a weather API, load a package.json file, or receive data from a Firebase database, you're almost certainly working with JSON.
JSON Building Blocks
JSON is built on two fundamental structures:
- Objects — unordered collections of key-value pairs enclosed in curly braces
{ } - Arrays — ordered lists of values enclosed in square brackets
[ ]
Values can be strings, numbers, booleans, null, objects, or arrays — allowing unlimited nesting depth.
Example JSON Document
{
"name": "John Doe",
"age": 30,
"isActive": true,
"address": {
"street": "123 Main St",
"city": "New York"
},
"hobbies": ["reading", "coding", "traveling"]
}
The Six JSON Data Types
- String: Text in double quotes —
"Hello World" - Number: Integer or decimal —
42or3.14 - Boolean:
trueorfalse - Null: Represents empty value —
null - Object: Key-value collection —
{"key": "value"} - Array: Ordered list —
[1, 2, 3]
JSON Syntax Rules
- All keys must be double-quoted strings
- String values use double quotes, never single quotes
- Commas separate items — but no trailing comma after the last item
- Comments are not allowed in standard JSON
- Special characters in strings must be escaped (
\n,\",\\)
Common Use Cases
- REST APIs: Request and response payloads in web services
- Configuration: package.json, tsconfig.json, settings files
- Data storage: Document databases like MongoDB and CouchDB
- Logging: Structured log entries for monitoring systems
- Data exchange: Between microservices, mobile apps, and web frontends
Getting Started with Our Tool
Paste any JSON into our free JSON viewer to instantly see a tree view, validate syntax, format with beautify, or minify for production. No account required.
Continue learning: How to Validate JSON · JSON Best Practices