Schema-driven, realistic mock data
🎯 Type-based generation
JSONLab reads the type keyword and generates a sensible value: strings, integers, numbers, booleans, nulls, arrays, and objects. Nested types are handled recursively.
📝 Example & default support
If a schema includes an example or default keyword, that value is used as-is. This makes it easy to ship realistic samples with your schema.
🎲 Enum handling
For schemas with an enum, JSONLab picks the first allowed value (deterministic) or randomizes on Regenerate. Great for status fields and category codes.
🧠 Smart string generation
Strings without defaults are generated based on the property name and format hint. A field named email becomes user@example.com; url becomes https://example.com.
🪆 Nested objects & arrays
Object properties and array items are recursively mocked. Generate deeply nested structures for testing complex API responses without writing fixture code.
🔁 Multiple values
Click Regenerate to produce a new sample from the same schema. Useful for stress-testing UI components against varied inputs, or for generating test datasets.
Mock generation — common questions
What JSON Schema features are supported?
JSONLab supports the most commonly used JSON Schema keywords: type, properties, items, required, enum, default, example, const, minimum, maximum, minItems, anyOf, and oneOf. Format hints like email, date-time, and uri trigger smart string generation.
More advanced features — such as $ref, allOf, pattern, format with strict validation, and conditional schemas (if/then/else) — are not currently supported. The goal is to cover the 90% case for quick mock data, not to be a complete schema evaluator.
For full JSON Schema validation, use the JSON Validator, which can validate against a schema.
How is the mock data randomized?
When a schema has an example or default keyword, that value is used as-is — no randomization. For schemas without those, JSONLab generates a value based on the type, format, and (for strings) the property name.
Strings are matched against common key names: email produces user@example.com, url/website produces https://example.com, name produces John Doe, and so on. Numeric fields respect minimum and maximum bounds.
Click Regenerate to produce a fresh sample — random parts (like names and numbers within a range) will vary on each click.
How does this compare to faker.js?
Faker.js generates random values directly from code — you call faker.person.firstName() in your test files. JSONLab generates values from a JSON Schema description, which means your mock data is always aligned with your API contract.
The schema-driven approach has several advantages: it works across languages (the schema is just JSON), it documents your data shape in one place, and it ensures your mocks respect constraints like enum, minimum, and maximum.
The trade-off is that JSONLab's smart string generation is simpler than faker's — it covers the common cases (email, url, name, date) but doesn't have faker's hundreds of localized data sources. For most testing and prototyping, this is more than enough.
What format hints are supported?
For string fields, JSONLab recognizes the following format values: email (produces user@example.com), date-time (ISO 8601 timestamp), date (YYYY-MM-DD), uri and url (https URL), uuid (random UUID v4), and ipv4 (random IP address).
For unrecognized formats, JSONLab falls back to a sensible default based on the property name. If the name itself doesn't match a known pattern, it produces a generic string like "string" or a value derived from the field name.
If you need a format that's not currently supported, you can always provide an example in your schema to override the generated value.
How fast is mock generation?
Mock generation is essentially instantaneous. The algorithm walks the schema tree once and produces a value, so the time complexity is linear in the number of schema nodes. Even deeply nested schemas with hundreds of properties generate in single-digit milliseconds.
For very large schemas (thousands of properties), you might notice a few tens of milliseconds — still imperceptible in practice. There's no network involved; everything happens in the browser.
If you generate many samples via Regenerate, the bottleneck is usually rendering the output, not the generation itself. JSONLab uses syntax highlighting which can be slow on extremely large outputs.