JSON Schema from Examples: APIs and LLM Structured Output
Infer a draft schema from sample JSON, validate with AJV, copy OpenAI and Anthropic structured-output snippets.
Why API teams live on JSON Schema
Contracts power OpenAPI specs, gateway validation, and SDK generation. Hand-writing schemas drifts from real payloads; inferring a draft from one representative JSON then tightening rules is faster and safer.
What inference gives you (and what it does not)
The inferrer maps value types to type, nested objects, arrays, and required keys. It will not invent business rules—enums, formats, min/max—until you add enum, pattern, minimum, etc.
Validate with AJV
Paste candidate JSON to see pass/fail before shipping. Reuse the same schema in CI for request/response guards.
Structured LLM output
Free-form model text is hard to pipe into databases. OpenAI response_format / tool parameters and Anthropic tool schemas need valid JSON Schema. FormaX copies ready-made snippets after inference so you skip spec archaeology.
Workflow
- Grab a real success payload from logs or docs.
- Generate a draft in the JSON Schema tool.
- Add descriptions, enums, and formats.
- Stress-test edge cases in the validate tab.
- Publish to OpenAPI, your API gateway, and LLM configs.
Runs locally in the browser. Open the tool.