How to generate json mock data for unit test fixtures
- Step 1Open the generator and set a record count — The tool has three controls: Record count, Seed, and a Sequential IDs checkbox. Set the count to how many fixture records you need —
1for a single-object fixture,10for a small list. Free plan caps at 500 records; Pro raises it to 10,000. - Step 2Pick a seed and write it into the test's commit message or a comment — The seed (default
42) is the only thing that determines the output. Record which seed produced a fixture (e.g. a comment// generated at seed 42) so anyone can regenerate the identical file later. Different seeds give different-but-equally-deterministic data. - Step 3Decide id style with the Sequential IDs checkbox — Leave it off for random UUID
idvalues (good when your code treats ids as opaque strings). Turn it on for integer ids1, 2, 3…(good when a fixture stands in for an auto-increment primary key). Note that flipping this changes the other random fields too — the id mode shifts the internal random stream. - Step 4Click Generate Mock Data — Generation is instant and local. The result panel shows the record count and output size, with a preview (truncated past 5,000 characters for display only — the download and copy contain the full output).
- Step 5Copy or download the fixture — Use Copy to paste the array straight into a test file, or Download to save
mock-data-<count>.json. Rename it to your fixtures convention (fixtures/users.json) on disk. - Step 6Reshape if your fixture needs different fields — The shape is fixed, so adapt it after generation: drop fields you do not need with json-key-filter, rename keys (e.g.
createdAt→created_at) with json-key-renamer, or wrap the records in factory functions in your test setup for per-test overrides.
The three controls the generator actually exposes
These are the only options in the UI. There is no field editor, no schema input, and no formatting control — the output is always pretty-printed with 2-space indentation.
| Control | What it does | Default / range |
|---|---|---|
| Record count | How many records are emitted in the top-level array. Values are clamped to the plan limit | Default 10 · 1–500 (free) · 1–10,000 (Pro) |
| Seed | Integer that drives the seeded PRNG. The same seed always reproduces the same array; change it for a different deterministic dataset | Default 42 · any non-negative integer |
| Sequential IDs | Off = random UUID id; On = integer id 1..n. Toggling also alters the other random fields (it shifts the random stream) | Default off |
The fixed record shape (every record, always)
Every generated record has exactly these fields with these value styles. You cannot add, remove, or rename fields in the tool — do that afterward with a sibling tool.
| Field | Type | Value style / range |
|---|---|---|
id | string or number | UUID v4 by default; integer 1..n when Sequential IDs is on |
index | number | Always 1..n in order — independent of the id mode |
name | string | First Last from a pool of 10 first + 10 last names |
email | string | first.last@domain using only test domains (example.com, test.org, demo.net, sample.io, mock.dev) |
phone | string | Always +1-555-NNNN (4-digit, 1000–9999) |
age | number | Integer 18–77 |
status | string | One of active, inactive, pending, suspended |
address | object | Nested { street, city, zip } from fixed street/city pools; zip is a 5-digit string |
score | number | 0–100 with one decimal place (e.g. 47.1) |
createdAt | string | Date YYYY-MM-DD, year 2020–2024, day 01–28 |
active | boolean | true/false (roughly 70% true) |
Cookbook
Real recipes for using the seeded generator as a fixture source. All output below is the tool's actual emission at the stated seed.
A reproducible two-record fixture at seed 42
ExampleThis is the literal output for count 2, seed 42, Sequential IDs off. Anyone who sets the same seed and count gets exactly this — which is what makes it safe to check in.
Controls: count 2, seed 42, Sequential IDs off
[
{
"id": "ab732cc0-86ce-45f2-ad8f-78e93ffbe1ce",
"index": 1,
"name": "Grace Davis",
"email": "grace.davis@mock.dev",
"phone": "+1-555-7711",
"age": 36,
"status": "active",
"address": { "street": "550 Cedar Blvd", "city": "Ogdenville", "zip": "10345" },
"score": 47.1,
"createdAt": "2024-01-17",
"active": false
},
{
"id": "c89687c4-06f1-4c4a-bcdc-cf1c51c8732c",
"index": 2,
"name": "Carol Smith",
"email": "carol.smith@example.com",
"age": 21,
"status": "pending",
"score": 30.4,
"createdAt": "2023-11-15",
"active": false
}
]Integer primary keys for an auto-increment table fixture
ExampleTurning Sequential IDs on swaps the UUID for id: 1, 2, 3…. Note the non-id fields differ from the previous example even at the same seed — that is expected, because the id mode shifts the internal random stream.
Controls: count 3, seed 42, Sequential IDs ON
[
{ "id": 1, "index": 1, "name": "Grace Davis", "age": 28, "status": "pending", "active": false },
{ "id": 2, "index": 2, "name": "Frank Wilson", "age": 46, "status": "suspended", "active": false },
{ "id": 3, "index": 3, "name": "Bob Taylor", "age": 37, "status": "inactive", "active": true }
]
// (fields trimmed for brevity — every record still carries the full shape)Wrap generated records in a factory for per-test overrides
ExampleThe fixed shape is a feature here: because the field names never change, a single factory keeps tests terse. Generate the base array once, import it, and spread overrides per test.
// fixtures/users.json was generated at seed 42, count 10
import users from './fixtures/users.json';
const makeUser = (overrides = {}) => ({ ...users[0], ...overrides });
test('suspended users cannot log in', () => {
const u = makeUser({ status: 'suspended', active: false });
expect(canLogin(u)).toBe(false);
});
test('active adult passes', () => {
const u = makeUser({ status: 'active', age: 30, active: true });
expect(canLogin(u)).toBe(true);
});Assert on the stable index, not the random id
ExampleRandom UUID ids change with the seed, so do not assert on them. The index field is always 1..n in order, which makes a dependable positional assertion.
import users from './fixtures/users.json'; // seed 42, count 5
test('records are in stable order', () => {
expect(users.map(u => u.index)).toEqual([1, 2, 3, 4, 5]);
});
test('id is opaque — never assert its literal value', () => {
// GOOD: shape check
expect(typeof users[0].id).toBe('string');
// BAD (brittle): expect(users[0].id).toBe('ab732cc0-...')
});Trim the shape to match a leaner fixture
ExampleIf your unit under test only needs id, name, and status, generate the full records and drop the rest with json-key-filter so the fixture is minimal and the diff is readable.
Step 1 — generate count 5, seed 42 here.
Step 2 — paste into json-key-filter, keep only: id, name, status
Result:
[
{ "id": "ab732cc0-...", "name": "Grace Davis", "status": "active" },
{ "id": "c89687c4-...", "name": "Carol Smith", "status": "pending" }
]Errors and edge cases
Real errors and silent failures sourced from each platform's own documentation. Match the wording to the row, fix what the row says to fix.
You expected to paste your own schema
Not supportedOlder versions of this page implied you could paste an example object and the tool would infer fields. It cannot. The generator ignores any input and always emits the fixed person shape. To reach a custom shape, generate the base array and reshape it with json-key-filter and json-key-renamer.
Toggling Sequential IDs changed the names and ages too
By designSequential IDs does more than swap the id field — turning it on means the UUID generation step no longer consumes random numbers, which shifts every subsequent field's value. So the same seed produces different name, age, status, etc. between the two id modes. Pick the id mode first, then settle on a seed.
Two records have identical emails or names in a large set
ExpectedNames come from a pool of 10 first × 10 last = 100 combinations, and emails are derived from the name plus 5 domains. At counts above ~100 records, repeated names and even duplicate emails are statistically certain. If your test asserts email uniqueness, post-process or use a smaller count — the generator does not guarantee unique emails.
Free plan blocked a request for 2,000 records
Plan limitThe free plan caps generation at 500 records; the input is clamped and a request above it shows an upgrade message. Pro raises the cap to 10,000 records. There is a hard internal safety ceiling of 100,000 records regardless of plan.
You wanted compact one-line JSON
Not configurable hereOutput is always pretty-printed with 2-space indentation; the UI has no formatting control. For a minified single-line fixture, run the output through json-minifier. To re-pretty-print with a different indent, use json-prettifier.
The preview looks cut off
Display onlyThe on-screen preview truncates past 5,000 characters and appends a …(truncated) marker so the page stays responsive. The Copy and Download actions always contain the complete output — verify by checking the record count shown above the preview.
Phone numbers all start with +1-555
ExpectedPhones are always +1-555-NNNN — the 555 exchange is the reserved fictional-number range, so a fixture can never collide with a real US number. If a test parses phone numbers into a specific national format, account for this single shape.
createdAt never goes past 2024
ExpectedDates are generated in the year range 2020–2024 with day 01–28 (so February never overflows). If a test needs a createdAt in the future or near now, override that field after generation rather than expecting the generator to produce it.
Emails sent during a test to grace.davis@mock.dev bounced
By designAll domains are non-routable test domains. A test that accidentally tries to send real mail will fail to deliver rather than spam a real address — a safety property, not a bug. Keep your test transport mocked regardless.
Frequently asked questions
Can I generate fixtures matching my own object shape?
No. The generator emits a fixed person-record shape (id, index, name, email, phone, age, status, nested address, score, createdAt, active). It does not read a schema or example from you. Generate the base array and reshape it — drop fields with json-key-filter, rename keys with json-key-renamer, or wrap records in factory functions in your test setup.
How do I make a fixture reproducible across machines and CI?
Use the same seed and count. The generator is fully deterministic — seed 42, count 10 produces a byte-identical array everywhere. Record the seed in a comment or commit message next to the fixture so anyone can regenerate it. Avoid asserting on the random UUID id values, which change with the seed.
Should I use generated fixtures or hand-crafted ones?
Use generated fixtures for bulk shape and volume — list rendering, pagination, ordering. Hand-craft the specific edge cases your code branches on (null values, boundary ages, invalid statuses). A common pattern is to generate the base array, then override specific fields per test via a factory function so edge cases are explicit.
How do I get sequential numeric IDs instead of UUIDs?
Turn on the Sequential IDs checkbox. The id field becomes integers 1, 2, 3… in order. Be aware that toggling it also changes the other random fields at the same seed, because the id mode shifts the internal random stream — so choose the id mode before locking in a seed.
Are the generated emails safe to use in tests?
Yes. Every email uses a non-routable test domain (example.com, test.org, demo.net, sample.io, mock.dev), so a test that accidentally sends mail cannot reach a real inbox. Names that drive the email come from a small pool, so at large counts emails can repeat — do not rely on email uniqueness.
Why do two records share the same name?
Names are drawn from 10 first names and 10 last names — 100 combinations. Beyond ~100 records, repeats are unavoidable and intended; the tool prioritizes determinism over uniqueness. If you need unique names or emails, keep counts small or post-process the output.
How many records can I generate?
Up to 500 on the free plan and up to 10,000 on Pro. The input is clamped to your plan limit, and there is a hard internal ceiling of 100,000 records. For unit-test fixtures you rarely need more than a few dozen.
Can I change the indentation or get minified JSON?
Not in this tool — output is always 2-space pretty-printed. Run it through json-minifier for a single-line fixture, or json-prettifier to re-indent. For a quick validity check after editing, json-validator confirms the file still parses.
Can I generate TypeScript types for the fixture?
Yes — paste a generated record into json-to-typescript to get an interface for the fixed shape, or into json-schema-generator for a JSON Schema you can validate fixtures against in CI.
Is the index the same as the id?
No. index is always 1..n in array order regardless of the id mode, so it is a stable positional key for assertions. id is either a random UUID or a sequential integer depending on the checkbox. Assert on index for order, treat id as opaque.
Does my fixture data get uploaded anywhere?
No. Generation runs entirely in your browser. There is no schema to send (the tool ignores input) and the generated records never reach JAD Apps servers. Only an anonymous usage counter is recorded for signed-in dashboard stats.
How do I turn the fixture into seed data for a database?
Generate the records, then convert with json-to-sql for INSERT statements, or json-to-csv for a bulk-load file. The nested address object flattens differently per target, so review the converter's nested-object handling before loading.
Privacy first
Conversion runs locally in your browser. No file is uploaded — only metadata counters are saved for signed-in dashboard stats.