I’m currently working on a workflow where I generate JSON output using Claude AI and then try to parse it using the JSON module in Make. However, I keep running into the following error:
DataError
Source is not valid JSON.
Bad control character in string literal at position [varies]
What I have tried so far:
I attempted to clean the JSON string before passing it to the JSON parser by using:
{{replace(replace(replace(replace(replace(35.content.text; “\”; “”); “\n”; “”); “\t”; “”); “\r”; “”); “\b”; “”)}}
But the error persists.
Questions:
Has anyone else faced this issue when using JSON output from Claude?
Are there any additional hidden characters I should be replacing?
Would another approach be better for cleaning the JSON before parsing?
Any guidance would be greatly appreciated! Thanks in advance. 
1 Like
Hey @Alexander_Senger
You can use this tool to check your json and identify the issue.
Regards,
Msquare Automation - Platinum Partner of Make
@Msquare_Automation
1 Like
Hi @Alexander_Senger ,
Maybe you can attach the problematic JSON, it will be much easier to identify the issue.
Basically, special characters like double quotes, newlines, and backslashes often cause issues in JSON. Make.com provides the encodeURL()
function, which can safely encode special characters in a string.
Regards,
Hi, thanks for the tip. The problem seems to be that I’m outputting HTML tags like
in JSON, which is causing an error in the JSON parser. What could I do to parse the following input cleanly with the JSON parser?
{
"seo_title":"SEO-Text",
"seo_description":"SEO-Description",
"excerpt":"<ul>
<li>Text</li>
<li>Text</li>
<li>Text</li>
<li>Text</li>
</ul>",
"slug":"page-url",
"title":"Blogpost Title",
"content":"<h1>Title</h1>
<p>My Content</p>
<h3>FAQs</h3>
<ol>
<li>Question 1</li>
<li>Question 2</li>
</ol>
<p>External links:
<a href=""https":" target=""_blank"" rel=""nofollow"">Ankertext</a><br>
<a href=""https":" target=""_blank"" rel=""nofollow"">Ankertext</a><br>
</p>
"
}