Skip to content
faker.tools
All 79

Plate IV · Developer, API & Database Seeding Utilities

Custom Schema & Nested Object Builder

Define your own field names, nesting and arrays in a two-line DSL.

json
[
  {
    "id": 1,
    "name": "Alice Young",
    "email": "olivia.lopez@example.com",
    "profile": {
      "city": "Chicago",
      "country": "United States"
    },
    "orders": [
      {
        "sku": "HRC-2903",
        "price": 310.99
      },
      {
        "sku": "UTF-8843",
        "price": 897.99
      }
    ],
    "createdAt": "2026-10-12T23:11:06Z"
  },
  {
    "id": 2,
    "name": "Mark Hill",
    "email": "margaret.white@example.com",
    "profile": {
      "city": "Denver",
      "country": "United States"
    },
    "orders": [
      {
        "sku": "IBG-9419",
        "price": 105.99
      },
      {
        "sku": "UDE-8007",
        "price": 111.99
      }
    ],
    "createdAt": "2025-01-28T23:11:06Z"
  },
  {
    "id": 3,
    "name": "Nora Hernandez",
    "email": "mark.young@example.com",
    "profile": {
      "city": "Denver",
      "country": "United States"
    },
    "orders": [
      {
        "sku": "NIG-6290",
        "price": 601.99
      },
      {
        "sku": "FYI-2528",
        "price": 326.99
      }
    ],
    "createdAt": "2025-01-07T23:11:06Z"
  },
  {
    "id": 4,
    "name": "Emily Johnson",
    "email": "joseph.williams@example.com",
    "profile": {
      "city": "Brooklyn",
      "country": "United States"
    },
    "orders": [
      {
        "sku": "QNM-6062",
        "price": 52.99
      },
      {
        "sku": "GWK-3389",
        "price": 735.99
      }
    ],
    "createdAt": "2024-06-20T23:11:06Z"
  },
  {
    "id": 5,
    "name": "Mark Hill",
    "email": "joseph.martin@example.com",
    "profile": {
      "city": "Portland",
      "country": "United States"
    },
    "orders": [
      {
        "sku": "EBG-3060",
        "price": 240.99
      },
      {
        "sku": "WWZ-1457",
        "price": 489.99
      }
    ],
    "createdAt": "2025-12-12T23:11:06Z"
  }
]
102 lines · 1.8 KBGenerated in your browser · Custom Schema & Nested Object Builder

The other generators fix the field names. This one does not. Write profile.address.city: city and you get that exact nesting; write orders[3].sku: sku and you get three order objects, each with its own generated SKU.

What you can control

  • Dots create nested objects to any depth.
  • [n] repeats a path into an array of n elements, each generated independently.
  • Any unrecognised type is treated as a literal, so role: admin puts the string admin in every record.
  • Thirty-three built-in types, matching the field list the other developer tools use.

Testing ideas

  • Nesting. Use dots for objects and [n] for arrays (orders[3].items[2].sku) to reproduce your real payload shape, then test deeply nested rendering.
  • TypeScript interfaces. Append the generated interface to keep fixtures and types in sync, and let the compiler flag a fixture that drifts.
  • Single object. Switch the root to one object for configuration files and detail views.
  • Big documents. Generate up to 1,000 records to test virtualised lists and JSON viewers.

What this is not

The syntax is line-based and deliberately small. It has no unions, conditionals or references between fields — if you need those, generate the base records here and post-process them.

Questions

How do I nest an object?

Use dots in the path. `user.contact.email: email` produces `{ user: { contact: { email: "…" } } }`.

How do arrays work?

Append `[n]` to a path segment. `tags[3].name: title` creates a three-element `tags` array, each element with its own generated `name`.

What happens with an unknown type?

It becomes a literal string. That is how you pin a constant — `status: active` gives every record the same status.

Next in Developer

All 11 →