What is a JSON Object?
A JSON object is an unordered collection of key-value pairs enclosed in curly braces{}. Each key is a string, and each value can be any JSON type.
1{2 "key": "value",3 "anotherKey": 42,4 "nested": {5 "inner": true6 }7}Key-Value Pairs
Every pair follows the pattern "key": value with a colon separator:
Key Naming Conventions
camelCaseExample: "firstName"
Used by: JavaScript, TypeScript, Java
snake_caseExample: "first_name"
Used by: Python, Ruby, PostgreSQL
kebab-caseExample: "first-name"
Used by: CSS-like configs, HTTP headers
PascalCaseExample: "FirstName"
Used by: C#, .NET APIs
Nesting Objects
Objects can contain other objects, creating hierarchical data structures. This is how JSON represents complex real-world entities.
1{2 "user": {3 "id": 42,4 "profile": {5 "displayName": "Alice Chen",6 "avatar": "https://cdn.example.com/alice.jpg",7 "bio": "Full-stack developer"8 },9 "settings": {10 "theme": "dark",11 "language": "en",12 "notifications": {13 "email": true,14 "push": false,15 "sms": false16 }17 }18 }19}Nesting Depth
Real-World Patterns
1. REST API Response
1{2 "data": [3 { "id": 1, "title": "First Post" },4 { "id": 2, "title": "Second Post" }5 ],6 "pagination": {7 "page": 1,8 "perPage": 20,9 "total": 145,10 "totalPages": 811 },12 "meta": {13 "requestId": "req_abc123",14 "timestamp": "2026-03-28T12:00:00Z"15 }16}2. package.json Configuration
1{2 "name": "my-app",3 "version": "1.0.0",4 "scripts": {5 "dev": "next dev",6 "build": "next build",7 "start": "next start"8 },9 "dependencies": {10 "next": "^15.0.0",11 "react": "^19.0.0"12 }13}3. Error Response
1{2 "error": {3 "code": "VALIDATION_ERROR",4 "message": "Request body is invalid",5 "details": [6 {7 "field": "email",8 "issue": "Invalid email format",9 "received": "not-an-email"10 }11 ]12 }13}Try It Yourself
Build a JSON object that represents a product in an e-commerce catalog. Include name, price, description, categories (array), and availability (boolean).
Try It Yourself
Modify or extend this product object