Back to Home
Published: June 2026By Web Util Slyce Team8 min read

JSON Examples — Real-World Snippets & Sample Data

A collection of practical JSON examples covering API responses, configuration files, user profiles, and more. Use these as reference when working with JSON data. Format and validate your own JSON with our JSON Formatter or compare two JSON objects side by side.

1. Basic User Profile

A simple JSON object representing a user with various data types.

{
  "id": 1,
  "name": "Jane Doe",
  "email": "jane@example.com",
  "age": 28,
  "isActive": true,
  "balance": 1250.75,
  "registeredAt": "2026-01-15T08:30:00Z"
}

2. Nested Object (Address)

JSON supports nesting objects inside other objects for structured data.

{
  "user": {
    "id": 42,
    "name": "John Smith",
    "address": {
      "street": "123 Main Street",
      "city": "San Francisco",
      "state": "CA",
      "zip": "94105",
      "country": "USA"
    },
    "phone": "+1-555-0123"
  }
}

3. Array of Objects

API responses commonly return arrays of objects, such as a product listing.

{
  "products": [
    {
      "id": 1,
      "name": "Wireless Mouse",
      "price": 29.99,
      "inStock": true,
      "category": "Electronics"
    },
    {
      "id": 2,
      "name": "Mechanical Keyboard",
      "price": 89.99,
      "inStock": false,
      "category": "Electronics"
    },
    {
      "id": 3,
      "name": "USB-C Hub",
      "price": 34.99,
      "inStock": true,
      "category": "Accessories"
    }
  ]
}

4. API Response with Pagination

A typical paginated API response with metadata and results array.

{
  "status": "success",
  "code": 200,
  "data": {
    "items": [
      { "id": 1, "title": "Post One", "views": 1200 },
      { "id": 2, "title": "Post Two", "views": 850 },
      { "id": 3, "title": "Post Three", "views": 2100 }
    ],
    "pagination": {
      "page": 1,
      "perPage": 10,
      "total": 42,
      "totalPages": 5
    }
  }
}

5. Configuration File

JSON is commonly used for application and build tool configuration.

{
  "appName": "MyApp",
  "version": "2.1.0",
  "debug": false,
  "environment": "production",
  "features": {
    "darkMode": true,
    "notifications": true,
    "analytics": false
  },
  "database": {
    "host": "localhost",
    "port": 5432,
    "name": "myapp_db"
  }
}

6. Error Response

Standard structure for API error responses with code and details.

{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "The request contains invalid fields.",
    "details": [
      {
        "field": "email",
        "reason": "Invalid email format",
        "value": "not-an-email"
      },
      {
        "field": "age",
        "reason": "Must be a positive integer"
      }
    ],
    "requestId": "req_abc123"
  }
}

7. Mixed Data Types

JSON supports strings, numbers, booleans, null, arrays, and nested objects.

{
  "string": "Hello World",
  "integer": 42,
  "float": 3.14159,
  "boolean": true,
  "nullValue": null,
  "array": [1, 2, 3],
  "object": { "key": "value" },
  "date": "2026-06-01T12:00:00Z",
  "url": "https://example.com"
}

JSON Data Type Reference

TypeExampleNotes
String"Hello World"Double-quoted Unicode with backslash escaping
Number42, 3.14, -7Integer or floating point (no leading zeros)
Booleantrue, falseLowercase only
NullnullRepresents an empty or absent value
Array[1, "a", null]Ordered list of values, can mix types
Object{"key": "value"}Unordered key-value pairs

Frequently Asked Questions

What is JSON?

JSON (JavaScript Object Notation) is a lightweight data-interchange format that is easy for humans to read and write, and easy for machines to parse and generate. It is language-independent and widely used in web APIs and configuration files.

What is the difference between JSON and XML?

JSON is more compact, faster to parse, and maps naturally to programming language data structures. XML is more verbose but supports attributes, namespaces, and document validation with XSD.

Can JSON contain comments?

No, JSON does not support comments by specification. For configuration files that need comments, consider using JSONC (JSON with Comments), YAML, or TOML instead.

What is valid JSON syntax?

Valid JSON requires double-quoted strings, key names must be in double quotes, no trailing commas, and all data must be one of the six types: string, number, boolean, null, array, or object.