01 / JSON / json-generator
JSON Generator
Build a nested schema and generate mock JSON records.
How to use
- 01Set how many records you need (1 to 10,000) and, optionally, a root key such as users so the output is wrapped as { "users": [ … ] }.
- 02Define the schema. Each row has a field name and a type: one of 20 random value types, Fixed value, Object or Array.
- 03For an Object, or an Array set to of objects, press + child to add nested fields. For an Array of a single type, such as of Email, set the item type and the array length (0 to 100).
- 04Or open Build schema from a sample JSON, paste an example document and press Build schema to turn its structure into an editable schema.
- 05Press Generate, review the result in the Tree or Raw view, then Copy it or download it as data.json or data.csv.
What is this tool?
The JSON generator is a schema builder for mock data. You design the shape of each record, including nested objects, arrays of objects and arrays of single values, and choose what fills every field: one of 20 random types such as UUID, Email, Name, DateTime or Postal Code, or a fixed value that stays the same in every record. It can also infer a starting schema from a sample JSON document you paste in. That makes it the tool to reach for when you need data that matches a specific API contract, rather than the fixed field set of the JSON Test Data Generator or the consistent user profiles of the Random User Generator. All values are synthetic and generated locally in your browser.
Building a schema from a sample response
The fastest way to mock an existing API is to paste one real response into Build schema from a sample JSON. The tool walks the document and creates one schema field per key. Nested objects become Object fields, and arrays become Array fields whose length matches the sample. If an array's first item is an object, it becomes an array of objects with matching child fields.
Types are guessed from values first, then from key names. Booleans and numbers map to Boolean, Integer or Decimal. Strings that look like a UUID, an email, an http or https URL, or an ISO date or date-time get those types. Otherwise, key names decide. Keys containing email, phone, company, country, city, zip, url or username, for example, map to the matching type, and anything containing name falls back to Name.
For example, pasting {"msg": "Success", "search_results": [{"user_id": 1, "first_name": "Ava"}]} gives msg as String, and search_results as an array of objects with user_id as Integer and first_name as First Name. Switch msg to Fixed value "Success", raise the array length to 5, and every record now mirrors the real response shape.
Fixed values, arrays and CSV export
A Fixed value field is parsed as JSON when it can be. So 200 becomes a number, true a boolean, null a null and ["a"] an array, while text that isn't valid JSON, such as Success, is kept as a plain string. Use fixed values for status fields, API versions and anything a test asserts on exactly. Fields with an empty name are skipped, and generation stops with an error if no field has a name.
The CSV download flattens nested data into dot-notation columns, with array items indexed in brackets. A record with an address object and a three-item tags array produces columns such as address.city, address.country, tags[0], tags[1] and tags[2]. That makes the same dataset usable in a spreadsheet or a database import.
Common use cases
- Mocking a backend response that matches an existing API contract before the endpoint is built
- Generating contract-test fixtures with fixed status fields and random IDs and emails
- Seeding a local database or document store with nested sample records
- Producing bulk payloads, up to 10,000 records, to load-test an import endpoint
- Turning a captured production response into a reusable, synthetic fixture shape
- Exporting the same mock dataset as CSV for spreadsheet-based QA checks
FAQ
How do I generate mock JSON data from a schema?
Add a row per field, pick a type for each, nest with Object or Array, set the record count and press Generate. You can copy the result or download it as JSON or CSV.
Can I generate JSON from a sample document?
Yes. Paste an example under Build schema from a sample JSON and press Build schema. The structure becomes an editable schema with types guessed from the values and key names.
How many records can I generate?
Up to 10,000 records per run, and each array field can hold up to 100 items.
Can a field have the same value in every record?
Yes. Choose Fixed value and enter it. Valid JSON such as 200, true or ["a"] keeps its type, and anything else is used as a string.
How is this different from the JSON Test Data Generator?
The JSON Test Data Generator lets you tick from a fixed list of common fields. This tool lets you define any field names, nesting, array lengths and fixed values to match a specific API shape.
How are nested fields exported to CSV?
They are flattened into dot-notation columns such as address.city, with array items indexed, as in tags[0].
Is the generated data real?
No. All values are synthetic and drawn from small built-in lists, emails use the reserved example.com domain, and nothing is sent to a server.