Fix LLM JSON Output Errors in Zapier, Make.com, and Bubble — A No-Code Builder's Guide
ChatGPT and Claude JSON outputs silently breaking your Zapier or Make.com workflow? Learn the 5 failure patterns and how to repair them without writing code.
Have broken JSON right now? Fix it free in under 1 second — no signup.
Fix My JSON →You set up the perfect AI automation. ChatGPT generates a structured JSON response, your Zapier Zap picks it up, and everything should flow cleanly downstream. Then the Zap fails with a cryptic error: "We had trouble sending your Zap — The data returned from the model is not valid JSON."
Or maybe it's Make.com freezing on a JSON module: Could not parse the text as JSON error, a Bubble workflow silently discarding data, or n8n hanging mid-run with a parse exception.
Here's the problem: LLMs like ChatGPT, Claude, and Gemini generate JSON that looks valid — but frequently is not. Not because the AI is wrong. Because JSON is unforgiving, and LLMs are trained to communicate, not to pass a JSON linter.
This guide explains the five ways LLM JSON output breaks no-code workflows, with specific fixes for Zapier, Make.com, Bubble, and n8n.
Why LLMs Produce Broken JSON
JSON has exactly one correct format. Every quote must be a double quote. Every key must be quoted. No trailing commas. No comments. No unfinished arrays. No markdown decorations around the output.
LLMs were trained on human-written text — which includes JavaScript code, README files, API docs, and blog posts. Those sources use single quotes, trailing commas, comments, and markdown code fences constantly. So do LLMs, unless explicitly constrained.
Even with "JSON only" prompts and structured output modes enabled, LLMs fail approximately 8–15% of the time in production pipelines. For no-code builders without error handling, that failure rate shuts down the entire workflow.
The 5 LLM JSON Failure Patterns
1. Markdown Code Fence Wrapping
This is the most common failure. Instead of returning raw JSON, the LLM wraps it in a markdown code block:
json
{
"name": "Alice",
"score": 92
}
Your no-code platform receives a string starting with `json . JSON.parse() fails immediately — the backticks are not valid JSON.
> "Return ONLY the raw JSON object. Do NOT wrap it in markdown code blocks. Do NOT include any explanation. Start your response with { and end with }."
If the fence still appears, use a text transformation step before parsing (see platform-specific fixes below).
2. Trailing Commas
LLMs frequently produce trailing commas on the last element of arrays and objects:
{
"items": [
"first",
"second",
"third", ← invalid
],
"total": 3, ← invalid
}
Trailing commas are valid in JavaScript, valid in JSON5, valid in Python dictionaries — but illegal in JSON. JSON.parse() throws a SyntaxError on the first trailing comma it finds.
> "Ensure no trailing commas. The last element in every array and object must have no comma after it."
This helps but doesn't eliminate the problem. For a reliable fix, use the auto-repair approach in the platform sections below.
3. Single Quotes Instead of Double Quotes
JSON requires double quotes for both keys and string values. LLMs often use single quotes:
{
'name': 'Alice',
'score': 92
}
This is valid JavaScript object notation, valid Python dict syntax — and completely invalid JSON. JSON.parse() raises Unexpected token '.
> "Use double quotes for all keys and string values. Never use single quotes."
4. Truncated Output
When the JSON object is larger than the model's remaining token budget, the response gets cut off mid-structure:
{
"report": "Full analysis of the quarterly results...",
"items": [
{"id": 1, "label": "Revenue"},
{"id": 2, "label": "Expenses"
The JSON never closes. JSON.parse() fails with Unexpected end of JSON input.
max_tokens in your LLM step. Zapier's OpenAI action and Make.com's OpenAI module both expose this setting. Set it higher than you think you need — unused tokens are not billed on most providers.
For unavoidably large outputs, ask the model to generate a summary instead of a full dump, or break the request into smaller chunks.
5. Explanation Text Mixed In
The LLM adds a helpful preamble or postscript around the JSON:
Here is the JSON you requested:
{"name": "Alice", "score": 92}
Let me know if you need anything else!
Or more subtly, a single trailing sentence after the closing brace. Either way, JSON.parse() fails because the string doesn't start with { or [.
> "Respond with only the JSON. No preamble. No explanation. No text before or after the JSON object."
Platform-Specific Fixes
Zapier
Step 1 — Improve the promptIn your ChatGPT or Claude step, update the User Prompt or System Prompt to include the constraints above. Start the prompt with:
> "You are a JSON generator. Return ONLY valid JSON. No markdown. No explanation. No trailing commas. Double quotes only."
Step 2 — Add a Code by Zapier step before parsingIf the LLM still returns markdown fences or mixed text, add a Code by Zapier step (JavaScript) right after the AI step:
// Strip markdown fences and extract raw JSON
let raw = inputData.llm_output;
// Remove
json ... ``` wrappers
raw = raw.replace(/^``(?:json)?\s/i, '').replace(/\s``\s*$/, '');
// Trim whitespace
raw = raw.trim();
// Extract first JSON object or array if surrounded by text
const match = raw.match(/(\{[\s\S]\}|\[[\s\S]\])/);
if (match) raw = match[1];
output = [{cleaned_json: raw}];
Step 3 — Use Formatter by Zapier
After the Code step, add Formatter > Utilities > Line Itemizer or pass the cleaned string directly to the next action's JSON field. Zapier will attempt to parse it automatically when a step expects structured data.
Step 4 — Use AI JSONMedic for auto-repair
For workflows where you can't control the LLM output quality (e.g., processing third-party AI responses), add a Webhooks by Zapier step that POSTs the raw string to https://aijsonmedic.com/json-repair and uses the repaired JSON in subsequent steps. The repair engine handles trailing commas, single quotes, missing brackets, and code fence stripping automatically.
Make.com
Step 1 — Set the JSON module's text source carefully
Make's JSON > Parse JSON module is strict: it passes the input directly to the browser's native JSON.parse(). Map only the field that contains the raw JSON string — not the full HTTP response body if it includes extra text.
Step 2 — Add a Text Parser > Replace step
Before the JSON module, add Tools > Set Variable or Text Parser > Replace to strip common LLM artifacts:
- Search for: `
json ` → Replace with: (empty) ` ` → Replace with: (empty)Chain two Replace steps to handle opening and closing fences separately.
Step 3 — Use a Router for error handlingWrap the Parse JSON step in a Router with an error handler branch. If the JSON module fails, route to a HTTP > Make a Request module pointing to AI JSONMedic's repair endpoint. Feed the repaired output back into your main flow.
Step 4 — Extract with regex when neededIf the LLM consistently wraps JSON in explanation text, add a Text Parser > Match Pattern step before Parse JSON:
- Pattern:
(\{[\s\S]?\}|\[[\s\S]?\]) - Global match: No
- Use the extracted match as the Parse JSON input.
Bubble
Bubble's API Connector and Workflow actions don't expose raw JSON strings directly — they parse the API response automatically at connection time. But when you're using Bubble's API Connector to call an LLM that returns JSON as a string inside a field, you hit the same problem.
Step 1 — Return JSON as a nested fieldDesign your LLM call to return JSON wrapped inside a known field key:
{
"data": "{\"name\": \"Alice\", \"score\": 92}"
}
Then in your Bubble workflow, use the data field as the raw string.
The JSONPath Plugin or Toolbox Plugin can parse JSON strings in Bubble workflows. Pass the cleaned string through the plugin's JSON to thing action.
For complex LLM outputs, route through a lightweight intermediate step (a Zapier webhook, Make webhook, or a simple Cloudflare Worker) that cleans and validates the JSON before it reaches Bubble. This keeps Bubble's workflow logic clean.
n8n
n8n has native JSON handling and is generally more developer-friendly for JSON errors, but LLM output still breaks it.
Use the Code node as a repair step:const raw = $input.first().json.llm_response;
// Strip markdown fences
let cleaned = raw
.replace(/^
(?:json)?\s*/im, '')
.replace(/\s```\s$/m, '')
.trim();
// Try to parse; fall back to extracting first JSON block
let parsed;
try {
parsed = JSON.parse(cleaned);
} catch {
const match = cleaned.match(/(\{[\s\S]\}|\[[\s\S]\])/);
if (match) {
parsed = JSON.parse(match[1]);
} else {
throw new Error('Could not extract valid JSON from LLM output');
}
}
return [{ json: parsed }];
The n8n community thread 84930 documents a related issue where AI Agent nodes intermittently double-wrap output as {output: {output: ...}} vs {output: ...}. If you're seeing inconsistent structure, add an unwrap check:
javascript
if (parsed.output && typeof parsed.output === 'object' && parsed.output.output) {
parsed = parsed.output;
}
```
When Prompting Isn't Enough: Auto-Repair
Even with perfect prompts, LLM JSON failures occur in production. Prompting reduces the rate — it doesn't eliminate it.
For production no-code pipelines, add a repair step that runs on every LLM response before it reaches your parser. AI JSONMedic's JSON repair tool handles all five failure patterns automatically:
- Strips markdown code fences
- Fixes trailing commas
- Converts single quotes to double quotes
- Reconstructs truncated JSON (bracket balancing)
- Extracts embedded JSON from surrounding text
The repair runs in under 100ms and returns clean, parse-ready JSON — or an error with the specific failure reason so you can log and investigate.
Summary: No-Code JSON Repair Checklist
Before your next LLM automation goes live:
- [ ] Prompt constraint: "Return ONLY raw JSON. No markdown. No explanation. Double quotes. No trailing commas."
- [ ] Set max_tokens high enough to avoid truncation.
- [ ] Add a cleanup step (Code by Zapier / Make Replace / n8n Code node) to strip fences before parsing.
- [ ] Add error routing so parse failures don't silently kill the workflow.
- [ ] Add a repair fallback (AI JSONMedic API or manual fix step) for production reliability.
The five failure patterns above cover over 95% of real-world LLM JSON errors in automation workflows. Patch each one, and your no-code AI pipeline will survive production traffic.
FAQ
Why does ChatGPT return JSON with markdown even when I say "no markdown"?
LLMs are probabilistic — they don't reliably follow formatting instructions, especially when the instruction competes with patterns learned from billions of training examples. Adding explicit negative constraints helps, but the only reliable solution is to strip fences programmatically before parsing.
Is there a way to make Zapier automatically clean LLM output without a Code step?
Not natively. Zapier's Formatter app can do basic text transformations (trim, replace), but doesn't have a dedicated LLM output cleaner. A Code by Zapier step with the regex above is the most reliable option inside Zapier without an external service.
Does Make.com's OpenAI module handle JSON mode automatically?
Make's OpenAI module supports response_format: { type: "json_object" } when using compatible models (GPT-4o, GPT-4-turbo). This helps but doesn't guarantee valid JSON — the model can still truncate or add explanatory text in some edge cases. Always keep the Parse JSON error handler.
What does it mean when n8n shows {output: {output: ...}} nesting?
This is a known non-deterministic issue with n8n AI Agent nodes where the output wrapper isn't applied consistently. The Code node unwrap pattern above handles it. Alternatively, use a BasicLLMChain node instead of AI Agent when you need deterministic output structure.
Can I use AI JSONMedic's repair tool in a Make.com scenario?
Yes. Use Make's HTTP > Make a Request module to POST the raw LLM string to the AI JSONMedic endpoint. Map the repaired_json field from the response into your next JSON module. This adds one HTTP call per automation run — typically under 200ms — but eliminates parse errors entirely.
Is this a problem unique to ChatGPT?
No. Claude, Gemini, Mistral, and Llama models all produce invalid JSON at similar rates. The failure patterns differ slightly by model family, but the root cause is the same: chat-optimized LLMs trained to communicate, not to serialize data.
Still dealing with broken JSON?
Paste it in and get it fixed in under 1 second — free, no signup, no install. Works with ChatGPT, Claude, n8n, and any AI output.
Fix My JSON Free →Related Articles