Please tell me How to reliably parse Claude/LLM output that's wrapped in ```json code fences with the JSON > Parse JSON module?

:bullseye: What is your goal?

Hi everyone, I’m a non-developer building an RSS → AI summarize → WordPress auto-posting scenario.

What I’m trying to do:
Pull articles via RSS, summarize them into JSON with Anthropic Claude, parse that JSON, and create a WordPress draft. The whole flow works now except the final JSON parsing step.

Module chain:
RSS → Data store (Search records, for dedup) → Anthropic Claude (summarize into JSON) → JSON (Parse JSON) → WordPress (Create a post)

My goal: I want a reliable way to strip the markdown code fences (json ... ) that Claude wraps around its output, so the JSON > Parse JSON module can read it without errors.

:thinking: What is the problem & what have you tried?

The problem:
My Anthropic Claude module returns the summary as JSON, but it almost always wraps the output in a markdown code fence, like:

```json
{ "japanese_title": "...", "summary": "...", "category": "...", "tags": [...], "source": "..." }
```

When this goes into the JSON > Parse JSON module, I get:
DataError: Source is not valid JSON.
— because of the surrounding json and fences.

What I’ve already tried (and the result):

  1. Prompt instruction — I told Claude explicitly not to add code fences and to output only raw JSON starting with {. → Claude still adds the fences sometimes. Not reliable.

  2. replace() inside JSON string — I tried {{replace(replace(4.Text Response; “json"; ""); "”; “”)}} to strip the fences. → The formula was accepted, but on run I got: BundleValidationError: Missing value of required parameter ‘json’ (the field ended up empty). I suspect the triple-backtick characters aren’t handled correctly in the formula.

  3. Assistant prefill — I added a second message (Role: Assistant) containing just { to force Claude to continue from there. → This time Claude returned an empty Text Response, so only { reached the JSON module → “Source is not valid JSON” again.

My question:
What is the most reliable way, inside Make, to strip the surrounding json ... code fences from an LLM’s text output before passing it to the JSON > Parse JSON module?

Is there a recommended approach using the Text parser module (Match pattern / regex) to extract just the { … } part? If so, what pattern should I use? Or is there a better way to handle backtick characters inside replace()?

Thank you very much — this is the last piece I need to finish the automation.

:camera_with_flash: Screenshots (scenario flow, module settings, errors)

Hey there,

Every llm has an option under advanced settings to give you the response as a JSON file directly. No need to tell it in the prompt and then try and figure out how to parse it.

Welcome to the Make community!

Have you seen these previous discussions?

Your question may already have answers here:

Based on the above, you may have asked a duplicate question. Before creating a new topic in the forum, you can search this forum for existing answers and the Help Centre to get to a solution faster.

Still require assistance?

If the previous/related discussions are not similar to your question, please reply providing additional details to demonstrate the difference(s) between your question and the ones above.

If you require help understanding or implementing workarounds/solutions in the related discussions, please reply with more details of what you have tried, including screenshots.

@samliew