JSON Samples

JSON (JavaScript Object Notation) format examples from simple to complex structures

📋 Simple JSON Object

🟢 simple

Basic JSON object with key-value pairs

{
  "name": "John Doe",
  "age": 30,
  "isStudent": false,
  "email": "[email protected]"
}

📋 JSON Array

🟢 simple

JSON array containing multiple values

[
  "apple",
  "banana",
  "cherry",
  "date",
  "elderberry"
]

📋 JSON with Empty Values

🟢 simple

JSON showing various empty value representations

{
  "emptyString": "",
  "nullValue": null,
  "emptyArray": [],
  "emptyObject": {},
  "zeroNumber": 0,
  "zeroDecimal": 0.0,
  "falseBoolean": false
}

📋 JSON Array of Objects

🟡 intermediate

JSON array containing multiple objects

[
  {
    "id": 1,
    "name": "Alice",
    "age": 25,
    "city": "New York"
  },
  {
    "id": 2,
    "name": "Bob",
    "age": 30,
    "city": "London"
  },
  {
    "id": 3,
    "name": "Charlie",
    "age": 35,
    "city": "Tokyo"
  }
]

📋 Nested JSON Object

🟡 intermediate

JSON object containing nested objects

{
  "user": {
    "name": "John Doe",
    "profile": {
      "age": 30,
      "gender": "male",
      "address": {
        "street": "123 Main St",
        "city": "New York",
        "country": "USA"
      }
    }
  }
}

📋 JSON with Mixed Types

🟡 intermediate

JSON object with various data types including arrays, objects, and primitives

{
  "name": "Product Catalog",
  "version": 1.0,
  "isActive": true,
  "products": [
    {
      "id": "P001",
      "name": "Laptop",
      "price": 999.99,
      "inStock": 10,
      "tags": ["electronics", "computers"]
    },
    {
      "id": "P002",
      "name": "Smartphone",
      "price": 599.99,
      "inStock": 25,
      "tags": ["electronics", "mobile"]
    }
  ],
  "lastUpdated": "2025-01-01T12:00:00Z"
}

📋 API Response JSON

🟡 intermediate

Standard JSON structure for API responses

{
  "status": "success",
  "code": 200,
  "message": "Request processed successfully",
  "timestamp": "2025-01-01T12:00:00Z",
  "data": {
    "user": {
      "id": "USER12345",
      "name": "John Doe",
      "email": "[email protected]",
      "profile": {
        "age": 30,
        "gender": "male",
        "joinedAt": "2024-01-01T00:00:00Z"
      },
      "roles": ["user", "subscriber"]
    }
  },
  "pagination": {
    "currentPage": 1,
    "totalPages": 5,
    "totalItems": 45,
    "itemsPerPage": 10
  },
  "meta": {
    "requestId": "REQ-789012",
    "version": "1.0.0"
  }
}

📋 Configuration JSON

🟡 intermediate

JSON used for configuration settings

{
  "app": {
    "name": "My Application",
    "version": "1.2.3",
    "environment": "production",
    "debug": false,
    "port": 3000
  },
  "database": {
    "type": "postgres",
    "host": "localhost",
    "port": 5432,
    "name": "myapp_db",
    "credentials": {
      "username": "db_user",
      "password": "DB_PASSWORD",
      "ssl": true
    },
    "pool": {
      "min": 2,
      "max": 10
    }
  },
  "logging": {
    "level": "info",
    "format": "json",
    "outputs": ["console", "file"],
    "file": {
      "path": "/var/log/myapp.log",
      "maxSize": "10MB",
      "maxFiles": 5
    }
  },
  "security": {
    "cors": {
      "enabled": true,
      "origins": ["https://elysiatools.com", "https://app.example.com"],
      "methods": ["GET", "POST", "PUT", "DELETE"]
    },
    "jwt": {
      "secret": "JWT_SECRET",
      "expiresIn": "7d"
    }
  },
  "services": {
    "payment": {
      "gateway": "stripe",
      "apiKey": "STRIPE_API_KEY",
      "webhookSecret": "STRIPE_WEBHOOK_SECRET"
    },
    "email": {
      "provider": "sendgrid",
      "apiKey": "SENDGRID_API_KEY",
      "from": "[email protected]"
    }
  }
}

📋 Complex JSON Structure

🔴 complex

Complex JSON with nested arrays, objects, and various data types

{
  "company": {
    "name": "Tech Corp",
    "founded": 2000,
    "industry": "Technology",
    "location": {
      "country": "USA",
      "city": "San Francisco",
      "coordinates": {
        "lat": 37.7749,
        "lng": -122.4194
      }
    },
    "departments": [
      {
        "name": "Engineering",
        "head": "Alice Smith",
        "employees": [
          {
            "id": "EMP001",
            "name": "Bob Johnson",
            "position": "Software Engineer",
            "skills": ["JavaScript", "Python", "React"]
          },
          {
            "id": "EMP002",
            "name": "Charlie Davis",
            "position": "Backend Developer",
            "skills": ["Go", "Node.js", "PostgreSQL"]
          }
        ],
        "projects": [
          {
            "name": "Project Alpha",
            "status": "active",
            "deadline": "2025-06-01"
          },
          {
            "name": "Project Beta",
            "status": "planning",
            "deadline": "2025-09-01"
          }
        ]
      },
      {
        "name": "Marketing",
        "head": "Diana Evans",
        "employees": [
          {
            "id": "EMP003",
            "name": "Ethan Wilson",
            "position": "Marketing Manager",
            "skills": ["Digital Marketing", "SEO", "Social Media"]
          }
        ],
        "projects": [
          {
            "name": "Campaign X",
            "status": "active",
            "deadline": "2025-05-15"
          }
        ]
      }
    ],
    "financials": {
      "revenue": 1000000000,
      "profit": 150000000,
      "expenses": 850000000,
      "quarters": [
        { "quarter": 1, "revenue": 240000000, "profit": 35000000 },
        { "quarter": 2, "revenue": 250000000, "profit": 40000000 },
        { "quarter": 3, "revenue": 260000000, "profit": 45000000 },
        { "quarter": 4, "revenue": 250000000, "profit": 30000000 }
      ]
    },
    "tags": ["tech", "innovation", "growth"]
  }
}

📋 GeoJSON Example

🔴 complex

GeoJSON format for representing geographical data

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "name": "San Francisco",
        "population": 873965,
        "cityClass": "major"
      },
      "geometry": {
        "type": "Point",
        "coordinates": [-122.4194, 37.7749]
      }
    },
    {
      "type": "Feature",
      "properties": {
        "name": "New York City",
        "population": 8804190,
        "cityClass": "major"
      },
      "geometry": {
        "type": "Point",
        "coordinates": [-74.006, 40.7128]
      }
    },
    {
      "type": "Feature",
      "properties": {
        "name": "Los Angeles",
        "population": 3898747,
        "cityClass": "major"
      },
      "geometry": {
        "type": "Point",
        "coordinates": [-118.2437, 34.0522]
      }
    },
    {
      "type": "Feature",
      "properties": {
        "name": "California",
        "state": "CA"
      },
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [-124.48201944037265, 40.440630133689096],
            [-124.38966410701322, 37.18018892607658],
            [-122.2344979653738, 36.99742992327278],
            [-114.13122416650424, 32.534136409845824],
            [-114.6399218947989, 40.39573804578282],
            [-124.48201944037265, 40.440630133689096]
          ]
        ]
      }
    }
  ]
}