Generate JSON Schema from API Response
This example generates a JSON Schema (draft-07) from a typical REST API response. The pre-filled JSON represents a user object with nested address, array of roles, and array of post objects. Switch to Schema mode to see the inferred schema.
What You Get
The tool produces:
- A root object schema with
type: "object"and all top-level properties requiredarray listing all present fields- Integer detection:
idandlikesbecome"integer", not"number" - Nested object schemas for
addressandpostsitems - Array item schemas with typed properties
How to Use
- The example loads with a sample API response and Schema mode pre-selected
- Inspect the generated JSON Schema structure
- Copy the schema and use it with your validation library
- Replace with your actual API response to generate schemas for your endpoints
Real-World Pattern
REST APIs return structured JSON that maps cleanly to JSON Schema. Use the generated schema to validate API responses at runtime, document your API with OpenAPI/Swagger, or generate client-side types automatically.