JSON Mock Data Generator
About the JSON Mock Data Generator
This JSON mock data generator builds a JSON array of realistic fake records from a field list you define, ready to drop into a mock API, a frontend fixture or a unit test. Choose from 47 field types, set how many objects you need (up to 1,000), and copy or download the result as JSON or CSV.
What is mock JSON data?
Mock JSON is placeholder data shaped like the real response your app will receive. Frontend developers use it to build screens before the backend exists, and testers use it to check how a UI copes with long lists, empty fields or unusual names.
Good mock data uses the right JSON types. This generator emits numbers for prices and IDs ("price": 49.99), real booleans for flags ("inStock": true), and ISO 8601 strings for timestamps ("orderedAt": "2025-03-14T09:26:53.000Z"), so your parsing and formatting code gets exercised the same way it will in production.
Serving the generated JSON as a fake API
Save the download as db.json with a top-level key, for example {"products": [...]}, and run npx json-server db.json to get a full REST API at /products with filtering and pagination.
For browser and test mocks, return the array from a Mock Service Worker handler (http.get('/api/products', () => HttpResponse.json(data))), or import it as a fixture in Jest, Vitest, Cypress (cy.intercept(..., { fixture: 'products.json' })) or Playwright (route.fulfill({ json: data })).
Output shape and limits
The output is always a flat array of objects whose keys are the field names you enter, in the order you list them. Nested objects and arrays are not generated; if your API nests data, generate each level separately and combine them, or reshape the array in code.
Field names must be unique within a schema, and each run produces between 1 and 1,000 records. Every click on Generate draws fresh random values, so the output is not reproducible between runs. Save the file if your tests need the same data each time.
How to Use the JSON Mock Data Generator
- Pick a starting Preset such as Products, Users or Orders. The page opens with Products and sample output already generated.
- Edit the Fields list: rename a key, choose a new type from the dropdown, click Add field, or remove a row with the trash icon.
- Set Records (1-1000) and leave the Output format on JSON, or switch to CSV.
- Click Generate to create a fresh set of records.
- Click Copy to paste the array into your code, or Download to save mock-data.json.
Frequently Asked Questions
- Is the generated JSON sent to a server?
- No. Records are generated in your browser with crypto.getRandomValues, and nothing is uploaded or logged.
- Can I generate nested JSON objects?
- Not directly. Each record is a flat object. Generate the parent and child lists separately, or map the flat array into the nested shape in your code.
- Are the emails and phone numbers real?
- No. Emails use reserved domains such as example.com and mail.test, and phone numbers use the fictional 555-01xx range, so nothing can reach a real person.
- How many records can I generate?
- Up to 1,000 per run. For more, generate several batches and concatenate the arrays; IDs restart at 1 in each batch, so use UUID IDs if you need them unique.
- Can I get the same data again later?
- No. There is no seed, so each run is different. Download the file and commit it if your tests depend on fixed values.
- Can I export SQL inserts instead?
- This page focuses on JSON and CSV. The Mock Data Generator adds SQL CREATE TABLE and INSERT output for seeding databases.