JSON 示例

JSON(JavaScript 对象表示法)格式示例,从简单到复杂结构

样本信息

分类
Data Formats
样本数量
10
格式族
json

样本概览

JSON(JavaScript 对象表示法)格式示例,从简单到复杂结构 This sample set belongs to Data Formats and can be used to test related workflows inside Elysia Tools.

📋 简单 JSON 对象 json

🟢 simple

包含键值对的基本 JSON 对象

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

📋 JSON 数组 json

🟢 simple

包含多个值的 JSON 数组

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

📋 带有空值的 JSON json

🟢 simple

展示各种空值表示法的 JSON

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

📋 JSON 对象数组 json

🟡 intermediate

包含多个对象的 JSON 数组

[
  {
    "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"
  }
]

📋 嵌套 JSON 对象 json

🟡 intermediate

包含嵌套对象的 JSON 对象

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

📋 混合类型 JSON json

🟡 intermediate

包含数组、对象和基本类型等各种数据类型的 JSON 对象

{
  "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 响应 JSON json

🟡 intermediate

API 响应的标准 JSON 结构

{
  "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"
  }
}

📋 配置 JSON json

🟡 intermediate

用于配置设置的 JSON

{
  "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]"
    }
  }
}

📋 复杂 JSON 结构 json

🔴 complex

带有嵌套数组、对象和各种数据类型的复杂 JSON

{
  "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 示例 json

🔴 complex

用于表示地理数据的 GeoJSON 格式

{
  "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]
          ]
        ]
      }
    }
  ]
}