JSON Schema Builder & Validator
Infer a draft-07 schema from a JSON sample, then validate data against it — errors pinpointed to JSON Pointer paths, common keywords covered, fully local.
>_ USAGE GUIDE
Both ends of an API contract need a schema: writing one from scratch is tedious, and once you have one, checking data against it is repetitive. This tool connects the two directions: paste a JSON sample and get a draft-07 schema inferred in one click (objects recurse into properties + required, integers are distinguished from floats, arrays take their first element as the template), then drop the schema (editable) and your data into the validation panel — errors are pinpointed to JSON Pointer paths such as /users/0/name.
- Paste the JSON sample: an API response, a config file, any JSON fragment
- Click Generate: the draft-07 schema appears on the right, types and required fields at a glance
- Edit the schema as needed: relax required fields, add enums or length limits — it is plain JSON
- Paste the data to validate: click Validate to see a pass, or each violation with its keyword and path
- Copy and ship: both the schema and the result copy in one click, ready for CI or docs
>_ FAQ
Q1 · Which draft-07 keywords are supported?
The common subset is fully covered: type / required / properties / items / enum / const / minimum / maximum / exclusiveMinimum / exclusiveMaximum / minLength / maxLength / pattern / minItems / maxItems / uniqueItems / additionalProperties / format (format supports date-time, email, uri, ipv4, ipv6, uuid, regex). The full list is stated on the page; unsupported keywords are skipped silently — re-verify with a complete implementation such as Ajv for formal acceptance.
Q2 · How accurate is the generated schema — is required too strict?
Inference is grounded entirely in your sample: every field present goes into required, whole numbers infer as integer, decimals as number. If the sample only covers the happy path, required will indeed be strict — that is exactly why the schema panel is editable: removing occasionally-absent fields from required or adding minLength beats writing the schema from scratch.
Q3 · What does a path like /users/0/name in the errors mean?
It is a JSON Pointer (RFC 6901) path: layers from the root, arrays indexed by position. /users/0/name points to the name field of the first element of users. Each violation carries its keyword (type, required, pattern …) and this path, down to the exact field.
Q4 · Why not use Ajv — can a hand-written validator be trusted?
Site policy is zero dependencies and purely local computation: the validator is about 200 lines of pure functions covering ~90% of everyday cases, with regression tests. The trade-off is that combinators like if/then/else, $ref, and allOf are not supported. The page carries a fixed subset declaration; for formal acceptance (contract tests) re-check with a full implementation — this tool is built for fast error-finding and schema drafting, not compliance sign-off.
Q5 · Does my data get uploaded?
Never. Inference, editing, and validation all run locally in your browser with zero network requests; the page even works offline. For production samples, mask sensitive values first — the tool only inspects structure, so masking changes nothing.