Mock Schema Inferrer
Reverse-engineer a mock data schema from a sample JSON object.
POST
1 credit
/v1/mock-schema
curl -X POST "https://devtools.toolkitapi.io/v1/mock-schema" \
-H "Content-Type: application/json" \
-d '{
"sample": {
"id": 42,
"name": "Alice Johnson",
"email": "[email protected]",
"created_at": "2025-01-15T10:30:00",
"active": true,
"price": 29.99
}
}'
import httpx
resp = httpx.post(
"https://devtools.toolkitapi.io/v1/mock-schema",
json={
"sample": {
"id": 42,
"name": "Alice Johnson",
"email": "[email protected]",
"created_at": "2025-01-15T10:30:00",
"active": true,
"price": 29.99
}
},
)
print(resp.json())
const resp = await fetch("https://devtools.toolkitapi.io/v1/mock-schema", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
"sample": {
"id": 42,
"name": "Alice Johnson",
"email": "[email protected]",
"created_at": "2025-01-15T10:30:00",
"active": true,
"price": 29.99
}
}),
});
const data = await resp.json();
console.log(data);
# See curl example
Response
200 OK
{
"fields": [
{"name": "id", "type": "sequence", "options": {"start": 1}},
{"name": "name", "type": "name"},
{"name": "email", "type": "email"},
{"name": "created_at", "type": "datetime"},
{"name": "active", "type": "boolean"},
{"name": "price", "type": "price", "options": {"min": 1.0, "max": 999.99}}
],
"field_count": 6
}
Try It Live
Live Demo
Response
Description
Reverse-engineer a mock data schema from a sample JSON object.
How to Use
1
1. Pass a sample JSON object (or array of objects) in the `sample` field. 2. The response contains a `fields` array ready to use with the Mock Data Generator. 3. Review and tweak the inferred types if needed, then pass to `/v1/mock-data`.
About This Tool
Mock Schema Inferrer analyzes a sample JSON object and generates a mock data field schema compatible with the Mock Data Generator. It uses key names and value patterns to intelligently guess field types — emails, dates, UUIDs, names, prices, and more.
Feed the output directly into `/v1/mock-data` to generate realistic datasets that match your data shape.
Why Use This Tool
- Quick schema bootstrap — Paste a real API response and get a mock schema instantly
- Test data generation — Generate hundreds of rows matching your existing data shape
- API prototyping — Create realistic mock endpoints from example payloads
- Database seeding — Infer schema from existing rows, then bulk-generate test data
Frequently Asked Questions
How does it infer types?
First by key name heuristics (e.g. `email` → email type, `created_at` → datetime), then by value patterns (regex matching for emails, UUIDs, dates, URLs). Key name matching takes priority.
Can I pass an array of objects?
Yes — if you pass an array, the first element is used as the sample for inference.
Start using Mock Schema Inferrer now
Get your free API key and make your first request in under a minute.