JSON Schema Generator for Structured Output
Paste a sample JSON, get a JSON Schema, and copy an API request that makes the model return exactly that shape. Everything runs in your browser.
Every property is required, additionalProperties is false, and fields missing in some items become nullable. Strict structured output expects this.
Your JSON is processed in this browser and never uploaded.
Request settings (model, prompt)
Example model. Support for json_schema varies by model, so check the model page before relying on it.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "response",
"type": "object",
"properties": {
"name": {
"type": "string"
},
"age": {
"type": "integer"
},
"email": {
"type": "string",
"format": "email"
},
"joined": {
"type": "string",
"format": "date-time"
},
"skills": {
"type": "array",
"items": {
"type": "string"
}
},
"address": {
"type": "object",
"properties": {
"city": {
"type": "string"
},
"zip": {
"type": "string"
}
},
"required": [
"city",
"zip"
],
"additionalProperties": false
}
},
"required": [
"name",
"age",
"email",
"joined",
"skills",
"address"
],
"additionalProperties": false
}Run it on HiAPI in three steps
- 01Create a free account
Sign up with email, Google or GitHub. It takes about a minute.
Sign up - 02Create an API key
Generate a key in the dashboard and use it in place of YOUR_API_KEY.
Get an API key - 03Make your first call
Run the generated code. Your request shows up in the usage logs.
How to generate a schema for structured output
01Paste sample JSON
Use a real example of the output you want, with representative values. Include several array items so optional fields are detected.
02Review the schema
Check types and formats, and tweak names. Strict mode makes every field required, which is what strict structured output expects.
03Copy the API call
Pick cURL, Python or Node.js, add your key and run it. The result is a JSON string in choices[0].message.content.
JSON Schema generator FAQ
Is my JSON uploaded anywhere?
No. The schema and code are generated entirely in your browser. Nothing is sent to HiAPI or any other server.
What does strict mode change?
It marks every property as required, sets additionalProperties to false, and turns fields missing in some array items into nullable types. Strict structured output requires all of this.
Does every model support json_schema?
No. Support depends on the model. The example uses kimi-k3 with response_format.type set to json_schema. Check the model page for what each model accepts.
How is the schema inferred from one example?
Types come from your values, integers and decimals are told apart, arrays are merged across items, and string formats are added when every sample matches. A single example cannot show enums or value limits, so edit those by hand.
Where is the structured result in the response?
In choices[0].message.content as a JSON string. Parse it and validate the business fields in your application.