TToolbox
🧪

Mock Data Generator

Generate fake data for testing

About this tool

Mock Data Generators are essential for decoupling frontend/backend workflows, populating high-fidelity UI wireframes, seeding databases for stress tests, and preparing sales demos. Data privacy regulations forbid using real customer records in staging environments. This tool generates realistic, fully synthetic datasets—names, emails, phone numbers, postal addresses, dates, currency balances, and UUIDs—locally with zero network calls, ready for JSON or CSV export.

How to Use This Tool (Step-by-Step)

1

Define Schema & Data Types

Configure your target fields (id, name, email, phone, city, balance) and assign realistic semantic data types to each.

2

Set Generation Row Count

Select the number of mock rows to generate (10, 50, 100, up to thousands) and choose JSON array or CSV export format.

3

Generate & Download Dataset

Click 'Generate' to instantiate synthetic records in milliseconds. Inspect real-time previews and download the data file.

Localized Chinese & English Data

Features natural localized datasets for Chinese names and real civil districts, alongside realistic Western names and addresses.

Dual JSON & CSV Export Formats

Export directly as a JSON array for mock frontend API responses, or download standard CSV files for relational database seeding.

100% Client-Side Air-Gapped

Data synthesis runs exclusively inside your browser's V8 engine. Proprietary database schema designs remain completely private.

Data Privacy Compliance & Mocking Gotchas

  • •Never use production customer data in testing: Storing unmasked real user identities in development staging breaches GDPR and privacy laws. Use synthetic data.
  • •Test edge cases and dirty inputs: Include overly long names, null values, emojis, and negative balances to verify UI resilience against visual overflow.
  • •Use fixed random seeds for deterministic testing: In automated CI suites, locking the pseudo-random seed guarantees identical datasets across runs for reproducible debugging.

Code & Transformation Examples

Synthetic User Dataset Output Benchmark

Defined Schema Fields
• id         : 自增数字 / UUID
• name       : 随机中文姓名
• email      : 拟真电子邮箱
• phone      : 11 位中国大陆手机号
• city       : 省级行政区所在地
• balance    : 浮点数账户余额
Generated Mock Records (JSON)
[
  {
    "id": 1,
    "name": "张伟",
    "email": "[email protected]",
    "phone": "13812345678",
    "city": "上海市",
    "balance": 8520.50
  },
  {
    "id": 2,
    "name": "李娜",
    "email": "[email protected]",
    "phone": "15987654321",
    "city": "北京市",
    "balance": 12400.00
  }
]

* All records are synthetic yet conform to realistic format constraints, passing standard UI form validators.

Faker.js Integration Snippet

Faker.js in Node.js
import { fakerZH_CN as faker } from '@faker-js/faker';

const mockUsers = Array.from({ length: 5 }, () => ({
  userId: faker.string.uuid(),
  username: faker.person.fullName(),
  avatar: faker.image.avatar(),
  createdAt: faker.date.recent()
}));
console.log(mockUsers);
Core Productivity Benefit
在后端接口研发完成前,前端可直接使用 Mock 数据编写完整的列表展示、翻页加载与交互动画,真正实现前后端并行开发!

* Mock data enables frontend and backend teams to develop in parallel without blocking each other.

Frequently Asked Questions

Q: Are these phone numbers and emails real people's identities?

A: Absolutely not. All records are 100% synthetically generated in memory using procedural dictionaries. No real databases are involved.

Q: How do I bulk import generated CSV into MySQL?

A: Download the CSV file and use database GUI import wizards, or run `LOAD DATA INFILE 'data.csv' INTO TABLE ...` to ingest records in seconds.

Q: Does this tool support nested object structures?

A: It defaults to flat record collections. To simulate deep nesting, assign JSON string types to individual attributes for sub-collection modeling.

Related Tools

All processing happens locally in your browser. Your data is never uploaded to a server.
/