# Replace() function in Set Variable / Parse JSON not stripping markdown code fences (backticks) from Claude API response

**URL:** <https://community.make.com/t/replace-function-in-set-variable-parse-json-not-stripping-markdown-code-fences-backticks-from-claude-api-response/110848>\
**Category:** Questions\
**Tags:** arrays, error, filters, functions, api\
**Created:** [June 15, 2026, 7:08am UTC](https://community.make.com/t/replace-function-in-set-variable-parse-json-not-stripping-markdown-code-fences-backticks-from-claude-api-response/110848 "2026-06-15T07:08:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shivika\_Srivastava](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@Shivika\_Srivastava](https://community.make.com/u/Shivika_Srivastava)\
**Post date:** [June 15, 2026, 7:08am UTC](https://community.make.com/t/replace-function-in-set-variable-parse-json-not-stripping-markdown-code-fences-backticks-from-claude-api-response/110848/1 "2026-06-15T07:08:46Z")

</div>

### 🎯 What is your goal?

Strip leading `json and trailing ` markdown code fences from an Anthropic Claude API text response, so it can be parsed by the Parse JSON module.

### 🤔 What is the problem & what have you tried?

I’m processing news articles through the Anthropic Claude module, then trying to parse the response as JSON using the Parse JSON module. The issue: Claude’s text response is sometimes wrapped in markdown code fences (`json ... `), which breaks Parse JSON with “Source is not valid JSON. Code: DataError”.

I added a system prompt instruction telling Claude not to use markdown formatting, but the wrapper still appears occasionally.

What I’ve tried to strip the fences using replace():

1. Typed directly into Parse JSON’s “JSON string” field as text with an inserted variable chip:  
replace(replace(10. Text Response; “`json"; ""); "`”; “”)  
Result: the entire expression

---

<div class="post-metadata">

**Author:** ![Stoyan\_Vatov](https://avatars.discourse-cdn.com/v4/letter/s/5daacb/32.png) [@Stoyan\_Vatov](https://community.make.com/u/Stoyan_Vatov)\
**Post date:** [June 15, 2026, 9:18am UTC](https://community.make.com/t/replace-function-in-set-variable-parse-json-not-stripping-markdown-code-fences-backticks-from-claude-api-response/110848/3 "2026-06-15T09:18:43Z")

</div>

Open the anthropic module, toggle advanced settings and tell it to return the output as a JSON file instead of text.

---

<div class="post-metadata">

**Author:** ![Make\_Bot](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/make_bot/32/14661_2.png) [@Make\_Bot](https://community.make.com/u/Make_Bot)\
**Post date:** [September 13, 2026, 9:33am UTC](https://community.make.com/t/replace-function-in-set-variable-parse-json-not-stripping-markdown-code-fences-backticks-from-claude-api-response/110848/4 "2026-09-13T09:33:10Z")

</div>


