Control the AI Output Format (JSON, Tables, Lists)
Get consistent, parseable output by specifying the exact format, fields, and what to exclude.
Direct answer
To control the output format, state exactly what you want — JSON with named fields, a Markdown table, or a bullet list — plus any length limits and what to exclude (no preamble, no explanations). Provide a template or example of the format. Being explicit is what makes the output consistent and parseable.
Open the Prompt OptimizerWhen to use this
- You need machine-readable output like JSON.
- The model adds chatty preambles you do not want.
- You want the same structure every time for automation.
Steps
- Name the format: return valid JSON, a Markdown table, or a numbered list.
- List the exact fields or columns and their types.
- State exclusions: no preamble, no markdown fences, no commentary.
- Give a small template or example of the exact shape.
- Add a length or item-count limit if you need one.
Example
summarize this review
Summarize the review below. Return only valid JSON, no preamble, in this shape:
{
"sentiment": "positive | negative | neutral",
"summary": "one sentence",
"topics": ["..."]
}
Review: <paste review here>Common mistakes
- Without an explicit format the model defaults to prose; always state the shape.
- For JSON, say 'return only valid JSON, no code fences or commentary' or you get extra text.
- Give a template; describing the format in words alone is less reliable than showing it.
FAQ
- How do I make ChatGPT return JSON?
- Tell it to return only valid JSON with named fields, show the exact shape as a template, and say no preamble or code fences. An example of the structure is the most reliable approach.
- How do I stop the model adding extra commentary?
- State the exclusions explicitly: no preamble, no explanations, output only the requested format. Constraints on what NOT to include work as well as constraints on what to include.
- Why is my output format inconsistent?
- Usually the format is described vaguely or not at all. Provide a concrete template and constraints so the model has one clear shape to follow.
Related Prompt Optimizer guides
How to Structure a Prompt (Template)
The building blocks of a strong prompt — role, context, task, constraints, output format, and examples — with a reusable template.
Write a Prompt From a Rough Idea
Turn a one-line idea of what you want into a full, ready-to-paste structured prompt.
Few-Shot Prompting: Add Examples to Your Prompt
Show the model one to three input-output examples so it copies the pattern you want.
Chain-of-Thought Prompting: Ask for Step-by-Step Reasoning
Prompt the model to reason step by step to improve accuracy on multi-step math, logic, and planning tasks.
Role and Persona Prompting (Act As)
Assign the model a role or persona to control tone, depth, and vocabulary in its answers.