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
- Tick the fields you need. Rename the entity (
user,order,customer) to change the wrapper key and the record names. - Pick a root shape: a plain array, an API-style
{ "data": [...] }envelope, an object keyed by id, or newline-delimited JSON. - Switch on sprinkle nulls to make optional fields sometimes
null. That finds the code paths that assume a value is always there. - 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
addressobject. - Optional
nullvalues 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 objectyou 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.