How to generate json mock data for unit test fixtures
- Step 1Define the schema shape — Paste an example JSON object representing the shape you need. The mock generator infers the field names and types to use as the generation template.
- Step 2Configure generation options — Set the number of records to generate. Configure field-specific options: UUID for id fields, random names for name fields, realistic email addresses for email fields.
- Step 3Generate and download the fixture file — Click Generate. Download the output as a JSON fixture file (fixtures/users.json). Import directly into your unit tests or copy individual records as needed.
- Step 4Use as test factory functions — Convert the generated JSON into factory functions in your test setup: const makeUser = (overrides = {}) => ({ ...userFixture, ...overrides }). Factory functions allow per-test customization of the generated base fixture.
Frequently asked questions
Should I use generated fixtures or hand-crafted fixtures for unit tests?+
Use generated fixtures for the bulk data shape and hand-craft specific test cases that test edge conditions — null values, maximum lengths, invalid formats. Generated fixtures save time for the common case; hand-crafted fixtures ensure specific scenarios are covered.
How do I ensure fixture IDs are unique across all generated records?+
Generated UUID fields (id, userId, orderId) are unique by default. For sequential numeric IDs, enable the 'Sequential IDs' option so generated records have id: 1, 2, 3... rather than random numbers.
Is the fixture schema transmitted to JAD Apps?+
No. Mock generation runs entirely in your browser. Schema definitions and generated data are never transmitted to JAD Apps servers.
Privacy first
Conversion runs locally in your browser. No file is uploaded — only metadata counters are saved for signed-in dashboard stats.