What the generator infers
| JSON | JSON Schema |
|---|---|
"ada@example.com" | { "type": "string", "format": "email" } |
"2026-10-24T09:30:00Z" | { "type": "string", "format": "date-time" } |
36 | { "type": "integer" } |
9.5 | { "type": "number" } |
[1, "a", null] | { "type": "array", "items": { "type": ["integer", "string", "null"] } } |
| key missing in some array items | left out of required |
Formats detected: date-time, date, email, URI, UUID and IPv4. A sample can't show everything (enums, minimum and maximum values, patterns), so tighten the schema by hand where you know more.
Validate data against the schema
import Ajv2020 from "ajv/dist/2020.js"; // npm install ajv ajv-formats
import addFormats from "ajv-formats";
const ajv = new Ajv2020();
addFormats(ajv); // email, date-time, uuid, uri…
const validate = ajv.compile(schema);
if (!validate(data)) console.log(validate.errors);from jsonschema import validate, ValidationError # pip install jsonschema
try:
validate(instance=data, schema=schema)
except ValidationError as e:
print(e.message)Related tools
Need TypeScript types or a Zod schema instead? Use JSON to TypeScript & Zod. Turning an API into an AI agent tool? The AI Tool Generator builds the schema from a curl command. Clean up messy JSON first with the JSON formatter.