# Structured output Source: https://docs.getworg.com/structured-output With response_format the reply is JSON: any valid JSON object, or one that follows a schema you send. ## Lanes Both modes work on `deepseek-v4.1-flash:cached`, `deepseek-v4.1-flash:standard` and `qwen3.8-27b:standard`. In testing, each lane returned JSON even when the prompt asked for a poem. ## Follow a schema cURL: ```bash curl https://api.getworg.com/v1/chat/completions \ -H "Authorization: Bearer $WORG_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "deepseek-v4.1-flash:cached", "messages": [{"role": "user", "content": "Rate this review from 1 to 10: The delivery was late but the support team fixed it the same day."}], "response_format": { "type": "json_schema", "json_schema": { "name": "review_score", "strict": true, "schema": { "type": "object", "properties": { "score": {"type": "integer"}, "sentiment": {"type": "string", "enum": ["negative", "mixed", "positive"]} }, "required": ["score", "sentiment"], "additionalProperties": false } } }, "reasoning_effort": "none", "max_tokens": 200 }' ``` message.content: ``` { "score": 7, "sentiment": "mixed" } ``` - Set `"strict": true`, list every property in `required`, and set `"additionalProperties": false`. - The JSON is a string in `message.content`. Parse it in your code. ## Any JSON object `{"type": "json_object"}` makes the reply valid JSON, but the model picks the keys. Name the keys you want in the prompt, or use a schema. ## Check in your code - If `finish_reason` is `length`, the output was cut at `max_tokens` and the JSON is incomplete. Raise `max_tokens` and retry. - Validate the parsed object against your schema before you store or act on it. - Reasoning text, when on, comes in `reasoning_content`, not in `content`, so it does not break the JSON. Set `"reasoning_effort": "none"` when you only need the data. Next: [Tool calling](https://docs.getworg.com/tool-calling) ยท [Reasoning](https://docs.getworg.com/reasoning)