Extract JSON
AI / AgentPull JSON blocks out of mixed LLM output: handles markdown code blocks and inline JSON objects/arrays.
An LLM chat completion rarely returns just the JSON you asked for: it wraps it in a markdown fence, adds explanatory text before or after, or returns several objects mixed with commentary, and this scans for all of it and pulls out just the valid JSON blocks. It's pattern matching and JSON parsing, not a repair step. If the model produced technically invalid JSON (a trailing comma, say), pipe the extracted text into JSON Repair afterward rather than expecting this tool to fix syntax errors itself. Multiple JSON blocks in one response are all captured, so it's worth checking that the specific block you wanted was the one you got if a response contains several. The same extraction logic is available via the REST API and SDKs for parsing LLM output at scale rather than one response at a time.
How to use Extract JSON
- 1.Paste raw LLM output that contains a JSON object wrapped in a markdown code fence to pull out just the valid JSON.
- 2.Use it on messy chat completions where the model added explanatory text before or after the JSON you actually want.
- 3.Extract multiple JSON blocks from a single response when an LLM returns several objects or an array mixed with commentary.
Frequently asked questions
Use via API, SDK, or MCP
cURL# Free: 1,000 req/day · Pro: 10,000 req/day
curl -X POST https://api.utilix.tech/v1/tools/extract-json \
-H "Authorization: Bearer utx_live_..." \
-H "Content-Type: application/json" \
-d '{"text":"Here is the result: {\"status\":\"ok\",\"count\":42} and some more text."}'Get an API key from your dashboard · Full API docs →