JSON Schema to Sample Data Generator Online
Generate realistic sample JSON from a JSON Schema (types, formats, enums, patterns, ranges, $ref, oneOf / allOf), validated against the schema.
Result
Press “Run” to see the result.
The schema mock API turns a JSON Schema into sample data: objects with their required and optional properties, arrays within minItems / maxItems, numbers within minimum / maximum and multipleOf, strings within their length limits, enum, const and examples, and the usual format values (email, date, date-time, uuid, uri, hostname, ipv4, ipv6).
Simple pattern values (digits, character classes, repetitions such as ^0[35789]\d{8}$) produce matching strings, local $ref (#/$defs/..., #/definitions/...) are resolved, allOf is merged and oneOf / anyOf pick a branch. Up to 100 items per call; the same seed gives the same data, so fixtures stay stable.
Every generated item is validated with the same validator as the JSON validator API (draft 2020-12): valid says whether all items pass. Keywords the generator does not handle (not, if / then, complex patterns) may produce invalid items, which are counted in invalid_items.
Use this in your code
curl -X POST "https://apibox.io.vn/v1/schema-mock" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"schema":{"type":"object","required":["id","email"],"properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"age":{"type":"integer","minimum":18,"maximum":99},"phone":{"type":"string","pattern":"^0[35789]\\d{8}$"}}},"count":1,"seed":"s"}'const res = await fetch('https://apibox.io.vn/v1/schema-mock', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"schema": {
"type": "object",
"required": [
"id",
"email"
],
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"email": {
"type": "string",
"format": "email"
},
"age": {
"type": "integer",
"minimum": 18,
"maximum": 99
},
"phone": {
"type": "string",
"pattern": "^0[35789]\\d{8}$"
}
}
},
"count": 1,
"seed": "s"
}),
});
const data = await res.json();
console.log(data);import requests
res = requests.post(
"https://apibox.io.vn/v1/schema-mock",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"schema": {"type": "object", "required": ["id", "email"], "properties": {"id": {"type": "string", "format": "uuid"}, "email": {"type": "string", "format": "email"}, "age": {"type": "integer", "minimum": 18, "maximum": 99}, "phone": {"type": "string", "pattern": "^0[35789]\\d{8}$"}}}, "count": 1, "seed": "s"},
timeout=30,
)
print(res.json())<?php
$ch = curl_init('https://apibox.io.vn/v1/schema-mock');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => '{"schema":{"type":"object","required":["id","email"],"properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"age":{"type":"integer","minimum":18,"maximum":99},"phone":{"type":"string","pattern":"^0[35789]\\\\d{8}$"}}},"count":1,"seed":"s"}',
]);
$response = curl_exec($ch);
print_r(json_decode($response, true));API documentation → Get a free API key
FAQ
Which drafts are supported?
Common keywords of drafts 7, 2019-09 and 2020-12. Validation of the output uses draft 2020-12.
Are remote $ref supported?
No, only references inside the same schema (#/...). Bundle your schema first.
Can I get the same data again?
Yes, pass the same seed and count; the seed used is always returned.