TryPromptFlow

Wrong Output Format: When AI Gets the Structure Wrong

You asked for a JSON object and got a paragraph. You needed a three-column table and got bullet points. The content is roughly right but the structure is wrong — and the output is unusable. This is a format specification failure, and it has a direct fix.

Diagnose your instructions free — 10 runs included

Root Causes of Format Failures

No format specifiedAI chooses the format most common for that type of request — usually a prose paragraph or unstructured list.
Ambiguous format instruction"Use a table" vs "a markdown table with columns Name, Value, and Notes" are very different instructions.
Conflicting signalsThe system prompt says JSON but the user message implies prose — AI resolves the conflict unpredictably.
No enforcement constraintFormat is requested but not required. Without a hard "respond only in X format" constraint, AI adds preamble and explanations that break parsing.

How to Specify Format That Sticks

Name the exact format at the start

Put the format instruction first, not last. "Respond as a JSON array of objects with fields: name (string), score (number 0–100), reason (string). Respond only with valid JSON." Starting with the format constraint prevents early context from implying a different structure.

Show a one-row example

Even a single example row eliminates most format ambiguity. For JSON: show one object with sample values. For a table: show one header row and one data row. For lists: show one item with the expected content type. An example communicates structure more reliably than a verbal description alone.

Add a hard enforcement constraint

End the format specification with: "Respond only in this format. Do not include explanations, preamble, or additional text." This prevents AI from adding commentary around the structured output that breaks downstream parsing.

Frequently Asked Questions

How do I get consistent JSON output from AI?

Specify the exact schema: name every field, its type, and whether it is required. Include a one-row example. End with: "Respond only with valid JSON. No markdown fences, no explanation, no extra text." Where available, use JSON mode for additional enforcement.

Why does AI ignore my formatting instructions?

Usually because the instruction is ambiguous, placed too late, or conflicts with an implicit signal earlier in the context. Move the format specification to the very beginning and make it specific: not "use a table" but "a markdown table with exactly these columns: [names]."

What is the best way to specify output format?

Four-part: (1) name the format explicitly, (2) show the structure, (3) give a one-row example, (4) add a hard "respond only in this format" constraint. The example is the most effective single addition when verbal description alone isn't working.