LLM Output Structure Detector

Automatically detect if LLM output is JSON, markdown, code, or plain text.

Ad placeholder (leaderboard)

Route LLM responses by what they actually are

When you process model output programmatically, the first question is always: what format is this? A response might be clean JSON, markdown, a code snippet, CSV rows, or plain prose — and treating one as another breaks your pipeline. This detector classifies the structural type, validates JSON for real, and flags responses that mix prose with a structured block so you can extract instead of parse.

How it works

The detector applies ordered heuristics. First it attempts to parse the text as JSON, both directly and after stripping a surrounding code fence, because valid JSON is the most actionable result. If that fails it scans for markdown signals — ATX headings, bullet and numbered lists, links, and emphasis. It detects source code by fenced language hints and common keyword density, and checks for consistent delimited rows that indicate CSV. The format with the strongest evidence is reported, along with a note on whether any embedded JSON or code block is present, which is the mixed-format case.

Tips and notes

Use the parse result, not just the type label: a response can look like JSON but fail to parse, and that distinction determines whether you can call JSON.parse directly or need a repair step. When a response is flagged as mixed-format, reach for an extraction step that pulls out the fenced block rather than parsing the whole thing. Detection is heuristic, so for short or ambiguous inputs it can misclassify — pair it with strict parsing in code. Everything runs locally and instantly, so drop it into any debugging workflow without cost or privacy concerns.

Ad placeholder (rectangle)