Controlling Claude's Output Format: Tables, JSON, and Lists

How to get answers in the format you want — tables, JSON, or lists — by naming the format clearly and locking it down with an example.

🌐 This article was machine-translated and may contain inaccuracies. Refer to the Korean original if in doubt.

The same question is far more useful when the answer comes back as a table, as JSON, or as prose, depending on what you need. Claude follows the output format you ask for, so simply being clear about the format makes the result much easier to work with.

Specify the format and Claude follows it Prompt "Format it as a table" Table JSON { } List

Name the format clearly

The basic move is to state the format precisely in words. Call the format by name — "format it as a table", "respond with JSON only", "give me a numbered list" — and it is even more reliable if you also say which columns a table needs or which keys a JSON object needs.

  • Table — for comparing or organizing items. Specify the column names you want.
  • JSON — for using the result directly in code or storing it as data. Define the key names and structure.
  • List — for laying out steps or items. Decide whether it should be numbered or bulleted.

Lock the format with an example

If the format is complex or you need the exact same shape every time, showing one example of the form you want is the most reliable approach, because Claude follows the structure of the example. This works on the same principle as giving examples (few-shot).

Organize this as the following table.
| Name | Trait | Best for |
| --- | --- | --- |
| (fill this in) |

Get clean JSON only

If you want to use JSON directly in code, a preamble like "Here is the JSON you requested" makes parsing a nuisance. In that case, tell Claude explicitly to drop the extra text — "output only JSON, no explanation". Defining the keys and value shapes in advance makes the result steadier.

If you are using the API, you can prefill the start of the assistant response so the answer begins with {, which prevents a leading explanation. This is an API-only feature that the web and app chat do not have.

When you need stricter structure

When valid JSON must be guaranteed every time, a prompt alone can occasionally drift from the format, so it is safer to add a step that validates the output. On the API, defining an input schema with tool use lets Claude fill values into that structure, which enforces the format more firmly.

In short, naming the format, locking it with an example when needed, and asking it to cut the filler will solve most formatting problems. For more, see the official Anthropic documentation.

Keep reading

Have a question or want to share how you use Claude?

Join the community to share tips with other users, or explore more guides.