JSON Generator

Schema Builder
1
-
2
3
4
-
5
6
7
-
Count:

Generate random Mock JSON data in one click without writing templates. Includes 13 built-in field types and a sample Schema, with custom field names, ranges, and array counts, perfect for frontend integration, API testing, and sample data construction.

Related

About the JSON Generator and Mock Test Data

A JSON Generator (also known as a JSON Mock tool) creates random JSON data that matches a declaratively defined structure with a single click. It is aimed at three core scenarios: frontend development, backend integration, and automated testing. When an endpoint is not ready or you need bulk test data, it removes the need to hand-write loops and random functions and gives you syntactically valid, structurally controlled test data.

Common JSON Generators fall into two camps: template-syntax tools (such as Handlebars-style {{repeat(5)}} on json-generator.com or random(1,100) functions on ExtendsClass) that offer maximum flexibility but require learning template syntax; and visual field builders (the approach used here) that let you add fields and choose types through a GUI. The WYSIWYG approach has the lowest barrier and is ideal for product managers, testers, and frontend engineers who are not full-stack.

Mock data is fabricated data that simulates real business data and must meet three criteria: structure consistent with real endpoints, field values within reasonable ranges, and coverage of typical scenarios. High-quality Mock data lets frontend teams complete 90% of their page work before APIs are ready, and keeps automated tests stable without depending on a real backend.

The 13 built-in field types in this tool cover most API testing scenarios: String / Integer / Number / Boolean for basic value types; Email / Name / UUID / Date / URL / Phone for business fields; Paragraph for long-form text; Enum for state machines, roles, and tier values; and Array for list fields. All generation happens locally in the browser via JavaScript with no network requests.

Randomness is the core of any JSON Generator: UUIDs follow RFC 4122 v4 (with correct version and variant bits), Emails combine a built-in name list with a test domain, and Dates are sampled randomly between 2020-01-01 and the current time. If your project needs reproducible test data (for example for regression testing), generate once, download as a .json file, and reuse it as a fixture.

Use Cases

  • Frontend development needs stable, repeatable Mock data for rendering components such as user lists, product cards, and order details
  • Backend endpoints are not yet ready, so frontend engineers need to fabricate data to integrate the page without waiting for backend responses
  • QA writing automated API test cases needs to batch-construct records with varied field values for data-driven test scenarios
  • When writing API documentation or Swagger/OpenAPI samples, use the generator to quickly produce well-structured request/response examples
  • Preparing large volumes of structured test data before stress and performance testing to validate system stability under high concurrency
  • Constructing sample JSON to validate business logic when developing database migration scripts or data cleaning tools
  • Teaching and demos: technical blog posts, slide screenshots, and training material that need tidy, well-structured JSON examples
  • Frontend form validation and local cache logic development, where boundary values (very small / very large / empty / abnormal types) need to be constructed for testing

How to Use

  1. Review the default sample Schema (id / name / email / age / active / createdAt / bio, 7 fields) in the left Schema builder, or click + to add your own custom fields
  2. Set a field name and pick from the 13 field types for each row; for Integer, Number, and Paragraph fields, fill in min/max, and for Enum fields, fill in comma-separated candidate values
  3. Tick Generate as Array and set a count (1-1000), or untick it to output a single JSON object
  4. Click Generate in the top right; the right-hand editor instantly shows formatted JSON results along with field count and record count
  5. Click Copy to paste the result into your code or API client, or click Download to save it as a generated.json file

Features

  • 13 built-in field types: String / Integer / Number / Boolean / Email / Name / UUID / Date / URL / Phone / Paragraph / Enum / Array ready out of the box, no template syntax to memorize
  • Visual field builder: add or remove fields through a graphical UI, set field names and types WYSIWYG, no need to hand-write JSON templates
  • Range control for numbers and paragraphs: Integer, Number, and Paragraph types support custom min and max, producing data closer to real business scenarios
  • Custom Enum values: enter a comma-separated value list (e.g. admin,user,guest) to generate controlled discrete options
  • Single object vs array with one click: toggle the Generate as Array checkbox plus a count input (1-1000) to freely switch between single object and array output
  • Sample Schema quick load: built-in 7-field example (id / name / email / age / active / createdAt / bio), click to generate a complete sample instantly
  • Syntax-highlighted output panel: a CodeMirror editor on the right shows real-time results with JSON syntax highlighting, line numbers, and read-only browsing
  • One-click copy and download: copy generated results to clipboard or download directly as a generated.json file
  • Runs entirely in your browser: all field construction and data generation happen locally, zero uploads, safe for sensitive business fields
  • Desktop and mobile friendly: split-pane layout on desktop with adjustable panels, mobile automatically switches to input/output tabs for smooth operation

Code Examples

JavaScript: use fetch with generated data for API integration

javascript

Place the downloaded generated.json under a local mock directory and have fetch intercept it for independent frontend integration.

// Put generated.json under /public/mock/users.json
// Then fetch it as Mock data
async function fetchMockUsers() {
  const res = await fetch('/mock/users.json');
  const users = await res.json();
  console.log(`Loaded ${users.length} users`);
  return users;
}

// Or inline directly in code (great for test cases)
const mockUsers = [
  { id: 1, name: 'Jennifer Martinez', email: 'jennifer.martinez382@example.com', age: 42, active: true },
  { id: 2, name: 'Robert Smith', email: 'robert.smith918@test.org', age: 67, active: false }
];

// Or import it as a fixture in Jest / Vitest
import users from './fixtures/users.json';
test('renders user list', () => {
  render(<UserList users={users} />);
  expect(screen.getAllByRole('listitem')).toHaveLength(users.length);
});

Python: use the Faker library for more complex Mock data generation

python

If the 13 field types in this tool are not enough, Python's Faker library offers 100+ localized generators that pair nicely with this generator.

# Install: pip install faker
from faker import Faker
import json

fake = Faker('zh_CN')  # Chinese localization

# Generate a single user
def gen_user():
    return {
        "id": fake.random_int(min=1, max=99999),
        "name": fake.name(),
        "email": fake.email(),
        "phone": fake.phone_number(),
        "address": fake.address(),
        "company": fake.company(),
        "created_at": fake.iso8601()
    }

# Generate 100 records and write them to generated.json
users = [gen_user() for _ in range(100)]
with open('generated.json', 'w', encoding='utf-8') as f:
    json.dump(users, f, ensure_ascii=False, indent=2)

print(f"Generated {len(users)} user records")

Command line: use curl + jq to POST generated data to an API

bash

During load testing or data initialization, use curl to POST the generator's generated.json directly to the target endpoint.

# Assume generated.json is in the current directory and the target endpoint is POST /api/users
# Bulk seed data
for i in $(seq 1 10); do
  curl -X POST https://api.example.com/users \
    -H "Content-Type: application/json" \
    -d @generated.json | jq '.'
done

# Or extract a single record with jq and POST it
cat generated.json | jq '.[0]' | \
  curl -X POST https://api.example.com/users \
    -H "Content-Type: application/json" \
    -d @-

FAQ

What does the JSON Generator do and how do I use it?

The JSON Generator instantly creates random JSON data that matches the structure you define, ideal for frontend Mock work, API integration, and automated tests. To use it: add fields in the left Schema builder and set field names and types (with optional min/max ranges or enum values), tick Generate as Array and enter a count, then click Generate to see results on the right, ready to copy or download.

Which field types are supported?

13 built-in field types are available: String (random string), Integer, Number (decimal), Boolean, Email, Name (English name), UUID (RFC 4122 v4), Date (ISO 8601 timestamp), URL, Phone (US format), Paragraph (multi-word text), Enum (custom values), and Array (string array). They cover the vast majority of API testing scenarios.

How do I control the count? Can I generate 1000 records at once?

Tick the Generate as Array checkbox and enter any integer from 1 to 1000 in the count input, then click Generate to output the requested number of objects. 1000 is the tool limit, which is enough for most API load testing and bulk seeding scenarios. For more, run a local script loop or use a library such as Faker.js.

How does the Enum field work? Can I customize the values?

After switching a field type to Enum, an input box appears. Enter comma-separated candidates (e.g. admin,user,guest or high,medium,low) and one is randomly selected on each generation. This is perfect for role, status, and tier fields where you want controlled discrete values instead of hard-coded ones.

Can I control the range of numbers and paragraphs?

Yes. Integer and Number types accept min and max values, and the tool generates random integers or decimals (2 decimal places) within that range. Paragraph types support min/max to control word count (e.g. 20-100 words). This makes data far more realistic and avoids obvious fakes like age=999999.

Are the generated UUIDs standards-compliant?

Yes. UUID fields are generated according to RFC 4122 v4, with the correct version bit (4) and variant bits (8/9/a/b), so they can be used directly as database primary keys, order numbers, tracking IDs, and so on.

Can I copy and download the generated results with one click?

Yes. Click the Copy button in the toolbar to copy the formatted JSON to the clipboard; click Download to save it automatically as generated.json. You can find the file in your browser's download list, and the file content matches exactly what you see in the editor.

What's the difference between the JSON Generator and a JSON Formatter?

They serve complementary purposes: the JSON Generator creates new random JSON data from scratch for testing and Mock work, while the JSON Formatter cleans up existing JSON for pretty printing and validation. A good workflow is to generate test data first, then run it through the Formatter for layout checks or to convert into TypeScript/Java structures.

Is the generated data uploaded to a server? Is it safe?

No. All field construction, random data generation, copy, and download operations run entirely locally in your browser via JavaScript. Data is never uploaded to any server, nor logged or cached. Internal API fields, pre-launch business structures, and sensitive test scenarios are all safe to use; closing the page clears everything.

How do I use the generated results directly for API testing?

Copy the result and paste it into the Body area of Postman, Apifox, or Apipost to send directly; or read it via JSON.parse as a fixture in Jest, Mocha, or Pytest; frontend developers can also place the downloaded generated.json under a local mock directory and intercept it with axios or fetch.

Are the generated Name and Email fields real data?

No, they are not real data. The Name field is randomly assembled from a built-in English first/last name dictionary, and Email combines first name + last name + a sequence number + a test domain (such as example.com or test.org). They are entirely fictitious samples. Do not use them for real business validation or send mail to any generated email address.

Can I generate a single object instead of an array?

Yes. Untick the Generate as Array checkbox and the tool outputs a single JSON object instead of an array, which is handy for single-record API debugging, documentation samples, or single-record previews. Tick the box again and enter a count to switch back to array mode.

Troubleshooting

Clicking Generate shows Please add at least one field

It means the current Schema has no rows with a valid field name. Check the left field builder: every row must have a field name to participate in generation, and empty field names are automatically skipped. Click + to add a new field, or use the default sample Schema at the top as a reference and re-enter field names.

Generated field order does not match the left builder

The JSON spec itself does not guarantee field order, but this tool outputs fields strictly in the order they were added from top to bottom in the Schema. Check whether any field was accidentally deleted or re-added on the left; if the order is still wrong, refresh the page and re-add fields in the desired order.

Enum field always generates an empty string

Enum fields need a comma-separated list of candidate values (such as admin,user,guest). If the input box is empty or contains only commas, you get an empty string. Make sure at least one valid candidate value is provided; the tool randomly picks one on each generation.

Numeric fields show NaN or undefined

This usually happens when min and max are left blank or contain non-numeric input. Integer/Number fields default to 0-100 even without explicit range, but entering letters or invalid negatives can cause issues. Recommendation: enter only integers, or leave the boxes empty to use the defaults.

Paragraph field generates text that does not read smoothly

The Paragraph type uses a built-in lorem word list and is intentionally not fluent English to avoid colliding with real paragraphs. For more natural text, try the Python Faker library or Hugging Face text generation APIs. For UI layout testing, lorem text is perfectly sufficient.

Cannot find the downloaded generated.json file

After clicking Download, the browser saves generated.json to the default download directory. Some browsers (especially mobile ones) require manually checking the download list. Safari users can find the download location in Preferences, while Chrome users can check the download icon next to the address bar.

Want to generate a single JSON object instead of an array

Untick the Generate as Array checkbox at the bottom of the Schema builder. Once unticked, regardless of the count input, only a single JSON object {} is output, which is great for single-record API debugging, documentation examples, or single-record fixtures.

Page stutters when generating 1000 records

1000 records is close to the limit for a single browser render. If scrolling in the right-hand editor becomes sluggish, try: 1) clicking Copy or Download immediately to grab the data and then close the page; 2) generating in batches (e.g. 500 + 500 then merge manually); 3) for extreme load testing, switch to native scripts such as Python Faker or Mock.js.

Glossary

JSON
JavaScript Object Notation, a lightweight data interchange format built from key-value pairs and arrays, the de facto standard for Web APIs and frontend/backend data transfer.
Mock Data
Fabricated data that simulates real business scenarios, used in frontend development, API integration, and automated testing where no real backend is connected. It must mirror the structure of the real endpoint.
Schema
A definition that describes the structure of data, for example a user contains id, name, and email. In this tool, Schema refers to the field names and types defined in the left field builder.
UUID (v4)
Universally Unique Identifier, a 128-bit string defined by RFC 4122. v4 is random-number based (with 13/8/9/a/b variant bits), virtually never collides, and is commonly used for distributed primary keys.
Field Type
The data type that every field in this tool must specify, which determines what kind of random value is generated for that field. For example, Email generates email-format strings while Integer generates integers.
Enum
A field type that randomly picks one value from a predefined discrete set. For example, defining admin,user,guest gives three options, ideal for roles, statuses, and tier fields.
min / max
Range constraints applied to a field, only effective for Integer, Number, and Paragraph types. When set, random values are generated within the closed interval, avoiding obviously fake boundary values.
Single object vs array output
Two output modes supported by the tool: when Generate as Array is unticked, a single JSON object {} is output (good for single-record API debugging); when ticked with a count, an object array [...] is output (good for bulk data).
RFC 4122
The international standard for UUIDs that defines UUID format, versions (v1-v5), and variant bits. The UUIDs generated by this tool comply with the v4 specification.
CodeMirror
A browser-side code editor component. The right-hand output area of this tool uses CodeMirror to provide JSON syntax highlighting, line numbers, and read-only browsing.
Local Processing
All field construction and data generation runs entirely in the user's browser via JavaScript, never uploaded to any server. It is faster, more private, and safe for sensitive business fields.
Fixture
A sample data file used repeatedly in tests. Generator output can be saved as generated.json and reused as a regression test fixture, ensuring reproducible test results.

Field types and generation rules cheat sheet

The value ranges, typical uses, and samples for all 13 built-in field types:

Field typeGeneration ruleSampleTypical use
StringRandom mix of a-z and 0-9, length between min and max (default 5-20)a8f3k0d2Generic random strings, ID prefixes, tokens
IntegerRandom integer in the closed interval [min, max] (default 0-100)42Age, quantity, count, sort order
NumberRandom decimal in the closed interval [min, max], 2 decimal places73.28Price, rating, coordinate, probability
Booleantrue / false with equal probabilitytrueIs active, is deleted, switch state
EmailfirstName.lastName + 1-999 + built-in test domainjames.smith247@example.comUser email, notification recipient
NameRandom combination from built-in English FirstName + LastName dictionariesJennifer MartinezUsername, customer name, author name
UUIDRFC 4122 v4, with version bit (4) and variant bitsf47ac10b-58cc-4372-a567-0e02b2c3d479Primary key ID, order number, tracking ID
DateISO 8601 timestamp between 2020-01-01 and the current time2024-08-15T07:23:11.000ZCreated at, updated at, effective date
URLhttps://www.{test domain}/{lorem word}-{1-999}https://www.test.org/lorem-742Avatar URL, redirect link, asset address
Phone+1-XXX-XXX-XXXX US-style phone format+1-415-308-7241Contact phone, support line
ParagraphLorem paragraph with min-max word count (default 10-50)lorem ipsum dolor sit amet ...Bio, remarks, description, comment
EnumRandomly picks one from a comma-separated custom value listadminRole, status, tier, type
ArrayArray of 1-5 String elements["a8f", "k0d", "92x"]Tags, keywords, auxiliary field sets

Common JSON generation scenarios and recommended field combinations

The most common API test data scenarios and recommended field combinations, ready to reference and add:

ScenarioRecommended field combinationSuggested count
User list APIid (Integer) + name (Name) + email (Email) + age (Integer 18-80) + active (Boolean) + createdAt (Date) + bio (Paragraph)20-50
Product list APIid (Integer) + name (String) + price (Number 10-9999) + stock (Integer) + category (Enum: electronics,clothing,food,book) + imageUrl (URL)30-100
Order APIorderId (UUID) + userId (Integer) + amount (Number 1-10000) + status (Enum: pending,paid,shipped,delivered) + createdAt (Date)10-30
Blog post listid (Integer) + title (String) + author (Name) + content (Paragraph 50-200) + tags (Array) + publishedAt (Date)10-20
Comment listid (Integer) + author (Name) + email (Email) + content (Paragraph) + rating (Integer 1-5) + createdAt (Date)50-200
Address book APIid (Integer) + name (Name) + phone (Phone) + city (String) + zipcode (String) + isDefault (Boolean)5-10

Privacy & Security

All field construction, random data generation, copy, and download operations in this JSON Generator run entirely locally in your browser via JavaScript. Your defined Schema, generated random data, field names, and counts are never uploaded to any server, nor are they logged, cached, or stored in the cloud. It is safe to use for internal API fields, pre-launch business structures, and sensitive test scenarios with no risk of data leakage.

Authoritative References