How to Generate Fake JSON Data for API Testing

June 20, 2026

Every developer has been here: you're building a new API endpoint, your frontend is waiting for data, and your database is empty. You need realistic-looking test data — now — but writing it by hand takes forever.

This guide walks through the fastest, most practical ways to generate fake JSON data for API testing, with working examples you can use immediately.


Why Use Fake JSON Data for API Testing?

Before diving into the how, it's worth understanding the why. Fake data — sometimes called mock data, dummy data, or test data — serves a few critical purposes:

Privacy compliance. Using real user data in development environments is a GDPR and HIPAA risk. A breach in a dev environment involving production data is still a breach. Fake data eliminates this entirely.

Availability. Your database is empty on day one. Your frontend team can't wait for the backend to be production-ready before they start building. Fake JSON lets both teams move in parallel.

Reproducibility. Real data changes. Test scenarios built on fake data stay stable and repeatable, which matters enormously for automated testing.

Edge case coverage. Real data rarely contains the edge cases you need to test — null values, maximum-length strings, Unicode characters, extreme timestamps. Generated data can be crafted to include exactly what you need.


Method 1: Dummy JSON Generator (Fastest — No Setup)

Dummy JSON Generator is a browser-based tool that generates realistic JSON data in seconds with no account or setup required.

When to use it: Quick prototyping, one-off test data needs, when you need data immediately.

Step-by-step:

  1. Open dummyjsongenerator.com/tool
  2. Add fields by clicking from the field type list (firstName, email, UUID, createdAt, etc.)
  3. Set your record count — anywhere from 10 to 1,000,000
  4. Click Generate → copy to clipboard or download as .json, .csv, or .sql

Example output — a user record schema with 5 fields:

[
  {
    "id": "a3f8b2c1-4e5d-6f7a-8b9c-0d1e2f3a4b5c",
    "fullName": "Ayesha Rahman",
    "email": "ayesha.rahman94@gmail.com",
    "city": "Lahore",
    "status": "active",
    "createdAt": "2024-08-14T09:33:21.000Z"
  },
  {
    "id": "b7c3d4e5-5f6a-7b8c-9d0e-1f2a3b4c5d6e",
    "fullName": "James O'Brien",
    "email": "jobrien_dev@outlook.com",
    "city": "Dublin",
    "status": "inactive",
    "createdAt": "2025-01-02T16:47:05.000Z"
  }
]

Notice the data looks genuinely real — different email formats, international names and cities, realistic timestamps. This matters more than you might think: UI components that look fine with "Test User 1" often break with names like "O'Brien" or "张伟" or addresses with special characters.


Method 2: Faker.js (For Programmatic Generation)

If you need to generate fake data as part of your test suite or seed script, Faker.js is the standard library.

import { faker } from '@faker-js/faker';
 
function generateUser() {
  return {
    id: faker.string.uuid(),
    fullName: faker.person.fullName(),
    email: faker.internet.email(),
    city: faker.location.city(),
    status: faker.helpers.arrayElement(['active', 'inactive', 'pending']),
    createdAt: faker.date.past({ years: 2 }).toISOString(),
  };
}
 
// Generate 100 users
const users = Array.from({ length: 100 }, generateUser);
console.log(JSON.stringify(users, null, 2));

When to use Faker.js: Automated tests that need fresh data on every run, seed scripts for development databases, CI/CD pipelines.

When NOT to use it: When you just need a quick JSON file — the browser tool is 10x faster for that.


Method 3: Mockaroo (For Complex Schemas with Relationships)

Mockaroo is a web-based tool with a GUI, similar to Dummy JSON Generator but with some paid features including API access and dataset relationships.

Use Mockaroo when you need related tables (e.g., users + orders where order.userId references a user) or when you need to generate data on a schedule via their API.


Using Fake JSON in API Testing Tools

Once you have your JSON data, here's how to use it in common testing workflows:

Postman — Mock Server

  1. In Postman, create a new Mock Server
  2. Add an example response — paste your generated JSON as the response body
  3. Postman gives you a URL like https://abc123.mock.pstmn.io/users
  4. Your frontend can now hit this URL and get real-looking data

Postman — Data-Driven Testing

  1. Save your generated CSV (not JSON) from Dummy JSON Generator
  2. In Postman, open a Collection → Run Collection
  3. Under "Data", upload your CSV file
  4. Postman iterates one request per row, using the CSV values as variables
// In your Postman request body:
{
  "email": "",
  "name": ""
}

Cypress — Test Fixtures

Save your generated JSON as a fixture file in cypress/fixtures/users.json, then use it in tests:

// cypress/e2e/users.spec.cy.js
describe('User list', () => {
  it('renders all users', () => {
    cy.fixture('users').then((users) => {
      cy.intercept('GET', '/api/users', { body: users }).as('getUsers');
      cy.visit('/users');
      cy.wait('@getUsers');
      cy.get('[data-testid="user-row"]').should('have.length', users.length);
    });
  });
});

MSW (Mock Service Worker)

MSW lets you intercept API calls in the browser during development:

// src/mocks/handlers.js
import { http, HttpResponse } from 'msw';
import users from './fixtures/users.json';
 
export const handlers = [
  http.get('/api/users', () => {
    return HttpResponse.json(users);
  }),
];

Tips for Better Test Data

Use realistic field combinations. A user with firstName: "Ahmed" and city: "Chicago" is more realistic — and catches more bugs — than firstName: "User1" and city: "City1".

Include edge cases in your dataset. After generating bulk fake data, manually add a few edge case rows: a user with a null phone number, a name with an apostrophe, a date far in the past or future.

Match your actual data shape. If your production user object has 20 fields, generate all 20 in your test data — not just the 5 you're currently testing. Missing fields that your frontend expects can hide bugs.

Generate more than you think you need. It's cheap to generate 1,000 records when you only need 10. Having the extra data lets you test pagination, search, and filtering without regenerating.


Summary

MethodBest ForSetup Required
Dummy JSON GeneratorQuick one-off JSON files, prototypingNone — browser tool
Faker.jsProgrammatic data in test suitesnpm install
MockarooComplex relational data, scheduled APIAccount (free tier available)
MSWIntercepting API calls in developmentnpm install

For most day-to-day API testing needs, Dummy JSON Generator gets you from zero to realistic test data in under a minute. It supports JSON, CSV, and SQL output, runs entirely in your browser, and handles up to 1 million records for load testing scenarios.


Have a specific data schema you need help generating? Check out the documentation for a full list of field types and configuration options.