JSON (JavaScript Object Notation) is a format for storing and exchanging data. Think of it as labeled storage boxes - organized, readable, and easy to transport.
When moving, you label boxes: "Kitchen - Plates", "Bedroom - Clothes". JSON works the same - data with clear labels that anyone can understand and use.
What JSON Looks Like
{
"name": "Alice",
"age": 25,
"email": "alice@example.com"
}
JSON Data Types
- 📝 String: "Hello World"
- 🔢 Number: 42, 3.14
- ✅ Boolean: true, false
- 📦 Object: {"key": "value"}
- 📚 Array: [1, 2, 3]
- ⭕ Null: null
Why Use JSON?
- 👁️ Human-Readable: Easy to read and write
- 🌐 Universal: Works in any programming language
- 📦 Lightweight: Compact data format
- 🔄 Easy to Parse: Convert to/from objects easily
Common Uses
- 🌐 APIs: Send data between client and server
- ⚙️ Config Files: Store application settings
- 💾 Data Storage: NoSQL databases
- 📱 Mobile Apps: Exchange data with backend
JSON vs XML
JSON:
- Simpler, more readable
- Less verbose
- Faster to parse
XML:
- More features
- Better for complex documents
- Older standard
Real-World Example
{
"city": "London",
"temperature": 18,
"conditions": "Cloudy"
}
The bottom line: JSON is like labeled storage boxes - a simple, readable format for organizing and transporting data. It's the standard for web APIs and data exchange!