Skip to content
faker.tools
All 79

Plate IV · Developer, API & Database Seeding Utilities

JSON Mock Data Generator

Arrays, API envelopes, keyed objects or NDJSON from thirty-three realistic field types.

json
[
  {
    "id": 1,
    "fullName": "Alice Young",
    "email": "alice.young@example.com",
    "city": "Boise",
    "isActive": true,
    "createdAt": "2026-01-30T23:11:06Z"
  },
  {
    "id": 2,
    "fullName": "Ryan Lopez",
    "email": "ryan.lopez@example.com",
    "city": "Brooklyn",
    "isActive": true,
    "createdAt": "2026-04-09T23:11:06Z"
  },
  {
    "id": 3,
    "fullName": "Linda Anderson",
    "email": "linda.anderson@example.com",
    "city": "Savannah",
    "isActive": false,
    "createdAt": "2026-04-21T23:11:06Z"
  },
  {
    "id": 4,
    "fullName": "Iris Martin",
    "email": "iris.martin@example.com",
    "city": "Portland",
    "isActive": true,
    "createdAt": "2024-05-09T23:11:06Z"
  },
  {
    "id": 5,
    "fullName": "Thomas Moore",
    "email": "thomas.moore@example.com",
    "city": "Boise",
    "isActive": true,
    "createdAt": "2025-08-04T23:11:06Z"
  }
]
42 lines · 898 BGenerated in your browser · JSON Mock Data Generator

A JSON mock data generator produces realistic fake records as JSON, so you can build and test an interface, an API client or a data pipeline before the real data exists. Pick fields from thirty-three types — names, emails, addresses, prices, SKUs, UUIDs, booleans, scores, tags and timestamps — choose a root shape, and copy or download the result.

Each record is built around one imaginary person, so fullName, email and username agree with each other. And the batch comes from a seed, so the same seed and settings give you the same records on any machine.

How to use it

  1. Tick the fields you need. Rename the entity (user, order, customer) to change the wrapper key and the record names.
  2. Pick a root shape: a plain array, an API-style { "data": [...] } envelope, an object keyed by id, or newline-delimited JSON.
  3. Switch on sprinkle nulls to make optional fields sometimes null. That finds the code paths that assume a value is always there.
  4. Set the record count (up to 2,000), copy or download, and commit the seed next to the test.

What you can control

  • Thirty-three field types across identity, location, commerce, status and time.
  • Four root shapes: array, { data: [...] } envelope, keyed by id, and NDJSON.
  • Address fields flat or nested under an address object.
  • Optional null values in non-key fields.
  • Pretty-printed or minified output.
  • Coherent records: one person per row, not a different stranger in every field.

Using the output in tests

As a fixture in Vitest or Jest:

import users from "./fixtures/users.json";

test("lists active users first", () => {
  const sorted = sortUsers(users);
  expect(sorted.findIndex((u) => !u.isActive)).toBeGreaterThan(sorted.findLastIndex((u) => u.isActive));
});

As a mocked API response in Playwright, so an end-to-end test does not depend on a backend:

import users from "./fixtures/users.json";

test("renders the user table", async ({ page }) => {
  await page.route("**/api/v1/users", (route) => route.fulfill({ json: { data: users } }));
  await page.goto("/admin/users");
  await expect(page.getByRole("row")).toHaveCount(users.length + 1); // + header row
});

For a full mock server, the guide Mocking REST APIs for frontend development covers MSW and json-server.

Testing ideas

  • Empty and huge. Generate 0, 1 and 2,000 records. Lists that look fine at 20 often break at both ends.
  • Nulls. Turn on sprinkle nulls and render the result. Every undefined is not an object you see is a real bug.
  • Envelope drift. Generate the same data as an array and as a { data } envelope, and check your client handles the shape your API actually returns.
  • Unicode. Switch the name generator to a Japanese or Brazilian locale for the same seed to find encoding and font problems.

What this is not

This is fixture data, not a schema validator or an API. For deep nesting use the custom schema builder; for full HTTP responses with status codes and headers use the REST API simulator; for database seeds use the SQL INSERT generator.

Questions

How many records can I generate?

Up to 2,000 per batch. For a larger dataset, generate several batches with different seeds, or switch to NDJSON and concatenate the files — each line is an independent record.

Do the fields in one record belong together?

Yes. Each record is built around one imaginary person, place and employer, so fullName, email, username and city agree with each other instead of being drawn independently.

Can I nest objects or arrays?

This tool can nest the address fields under an address object and emits tags as an array. For arbitrary nesting — objects inside arrays inside objects — use the custom schema builder, which takes a dot-and-bracket field list.

Is the output deterministic?

For everything except dates, yes: the same seed and settings produce the same records on any machine. Date fields such as createdAt are computed relative to the moment you generate, so the same seed tomorrow gives timestamps a day later. If a fixture's timestamps must never move, commit the generated file rather than just the seed.

What is NDJSON and when should I use it?

Newline-delimited JSON puts one complete JSON object on each line. It streams, appends and splits cleanly, which is why log pipelines, BigQuery, Elasticsearch's bulk API and many ETL tools prefer it to one large array.

Next in Developer

All 11 →