Without a format instruction, LLMs default to flowing prose. For conversational use that is fine. For a production system where the output feeds into code, a database, or a UI component, unstructured prose is unusable.
Format instructions are one of the most reliable types of prompt instruction — models follow explicit format requests very consistently. This makes output formatting one of the highest-value areas to specify carefully in any non-conversational prompt.
JSON — the standard format for programmatic output; use when the output will be parsed by code, stored in a database, or consumed by an API
Markdown table — use for comparisons, feature lists, or structured data that will be rendered in a UI or documentation tool
Numbered list — use for steps, rankings, or any output where order matters
Bullet points — use for unordered collections of items, key takeaways, or scannable summaries
Code block — use when the output is code, a command, a config file, or any technical syntax that should be rendered verbatim
Plain prose — use when the output will be displayed as natural text, read by a human, or used in a document context
Be explicit. Do not assume the model will infer the format you want from context.
"Give me the product information."
Format is unspecified. The model will produce prose, a list, or a table — whichever it predicts is most likely from context. Output will vary.
"Return a JSON object with exactly these keys: product_name (string), price (number), in_stock (boolean)."
Format type, field names, and field types are all specified. Output is predictable and parseable.
Often as important as specifying format: telling the model what to leave out. Models add explanation by default. Suppressing it when you do not need it keeps output clean and consistent.
"Return only the corrected code. Do not explain the changes." — strips prose explanation from a code output
"Return only the JSON object. No preamble, no explanation." — prevents the model from narrating what it's about to do before outputting
"Give the answer only. Do not repeat the question." — common for systems where question repetition wastes tokens and clutters output
"Do not include any commentary outside the JSON." — ensures a parser can read the output without stripping prose around the structured data
In production systems where model output is parsed by code, format inconsistency breaks the pipeline. A response that is sometimes JSON and sometimes a prose explanation will cause a JSON parser to throw an error. Reliability is a first-class concern, not a nice-to-have.
Use few-shot examples — show the model the exact format you want with 2–3 demonstrations before the actual task
Specify field names and types explicitly — ambiguous fields invite the model to invent its own schema
Suppress everything else — "Return only the JSON. Nothing else." is not redundant; it significantly improves consistency
Validate the output in code — always verify that the output parses correctly before using it; never trust a single prompt instruction to guarantee format in every case
Model explains the format instead of using it — add "Return ONLY the [format]. Do not describe what you are returning."
Format drifts in long outputs — the model loses the constraint partway through; add a few-shot example that demonstrates the full format across a similarly long output.
Model adds text before or after the structured output — add "Your entire response must be only the JSON object, with no text before or after it."
Ask the AI if you need help understanding output formatting, how to write format instructions for JSON or tables, how to suppress unwanted prose in model output, or how to ensure format consistency in a production pipeline.