How to use Mock API Dataset Generator
- Describe each resource as name(count) -> parent: field, field.
- Choose the id style and optionally a seed.
- Generate, download db.json and run npx json-server db.json.
Mock API Dataset Generator features
- Related resources with consistent foreign keys (users → posts → comments)
- json-server compatible db.json with integer or UUID ids
- Field placeholders inferred from names or given explicitly
- Default shapes for users, posts, comments, products, orders, customers, invoices and tasks
- Relation table, record counts and a ready-to-run usage snippet
Mock API Dataset Generator example
Blog dataset
Input:
users(3): name, email
posts(5) -> users: title
comments(6) -> posts, users: bodyOutput:
{
"users": [{ "id": 1, "name": "Mia Bennett", "email": "mia.bennett@example.com" }, …],
"posts": [{ "id": 1, "userId": 2, "title": "Notes on granite pipelines" }, …],
"comments": [{ "id": 1, "postId": 4, "userId": 1, "body": "Thank you for contacting our support team." }, …]
}Frequently asked questions about Mock API Dataset Generator
How do I define resources and relations?
One line per resource: users(10): name, email, then posts(30) -> users: title, body. Children receive a <parent>Id foreign key that points to an existing parent record; several parents are allowed.
Is the output compatible with json-server?
Yes. Save it as db.json and run npx json-server db.json — you get REST routes with filtering (?userId=1), sorting and pagination for free. The usage panel lists the routes.
How are field values chosen?
From the field name (email, price, createdAt, isActive…) or an explicit placeholder such as price:price:5-500. Resources named users, posts, comments, products, orders or customers have sensible defaults.
How big can the dataset be?
Up to 20,000 records in total. Use a seed for reproducible datasets in tests and demos.