I set up everything normally, tested the JSON and it is validated, when I activate the scenario after some messages, this error happens. And it continues for some time, but then it starts working again and soon the error appears again. Sometimes with different numbers.
Hey there, you have unescaped linebreaks in the response.
Wrap the response in a replace() function and replace each {{newline}} with \n.
Welcome to the Make community!
Modules Using Raw JSON
The HTTP “Make a request” or an app’s universal “Make an API call” modules uses raw JSON to transmit data. The HTTP body content field does not automatically escape variables mapped into it, and if the mapped variables contain JSON reserved characters (e.g. from the output of an AI module, or another JSON string), it breaks the structure of your outermost JSON.
Simple text string in the value is okay ![]()
Inserting special characters (like " and line-breaks), makes the JSON invalid. ![]()
Correctly escaped special JSON characters in the value
Escaping Variables Before Mapping Into Another JSON (string)
Most of the time, you cannot directly map variables containing text content into another JSON string without escaping them, as the variable might contain special characters that are reserved. Special characters in JSON needs to be escaped (encoded) as a “literal” character, otherwise they make the whole JSON invalid when you map the variable value when creating another JSON string.
A. Using “Transform to JSON” Module
You can escape variables by passing the text into the “Transform to JSON” module. You can also build a valid JSON string by using a Data Structure with the “Create JSON” module. Then, you can map the output of the Transform module into another JSON, or simply use the whole output of the Create module.
Note:
When using the “Transform to JSON” module on a string-type variable, the output should already contain the double quotes
" "around your text, so when you map this output into your JSON, do not wrap another pair of double quotes around it!
B. Using “Replace” Function
Alternatively, you can use the built-in function replace to replace those special characters with their escaped versions. To do this, simply paste this into the field, and replace the 1.text variable:
{{ replace(replace(1.text; "/([""\\])/g"; "\$1"); "/\r?\n\r?/g"; "\n") }}
Make Input Markup: Copy-paste the above into the field, including start/end curly brackets for it to import as intended
Further Information
For more information on JSON and escaping special characters, see:
- JSON - Wikipedia
- JSON - Glossary | MDN
- Introducing JSON
- How to escape special characters in building a JSON string?
Hope this helps! If you are still having trouble, please provide more details.
— @samliew








