# JsonMappingException (CTRL-CHAR, code 10) - replace(lf, space) failing to remove newline from string

**URL:** <https://community.make.com/t/jsonmappingexception-ctrl-char-code-10-replace-lf-space-failing-to-remove-newline-from-string/95371>\
**Category:** Questions\
**Tags:** error\
**Created:** [November 3, 2025, 6:35am UTC](https://community.make.com/t/jsonmappingexception-ctrl-char-code-10-replace-lf-space-failing-to-remove-newline-from-string/95371 "2025-11-03T06:35:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alvaro\_Melo](https://avatars.discourse-cdn.com/v4/letter/a/a9adbd/32.png) [@Alvaro\_Melo](https://community.make.com/u/Alvaro_Melo)\
**Post date:** [November 3, 2025, 6:35am UTC](https://community.make.com/t/jsonmappingexception-ctrl-char-code-10-replace-lf-space-failing-to-remove-newline-from-string/95371/1 "2025-11-03T06:35:21Z")

</div>

Hi everyone,

I’m struggling with a persistent `400 Bad Request` error when sending data from an HTTP module, and I’m out of ideas.

**The Error:** The HTTP module fails with a `JsonMappingException: Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using backslash...`

**The Cause:** My trigger is **RD Station (New Opportunity)**. Some leads are filling out text fields with newlines (by pressing “Enter”). I’ve confirmed this by inspecting the output bundle, which looks like this:

{  
“cf\_qual\_sua\_principal\_necessidade”: “This is the first line of text.\n\nThis is the second line after two ‘Enter’ presses.”,  
“cf\_qual\_o\_seu\_cargo”: “Sócio/Diretor”  
}

The `\n` (which is the `code 10` error) is breaking the JSON parser in my destination API (a custom CRM).

**My Scenario Architecture:** To solve this, I added a “Tools” module to clean the data _before_ it gets to the HTTP module.

My flow is: **[1] RD Station (Watch New Opportunities)** → **[4] Tools (Set multiple variables)** → **[2] HTTP (Make a request)**

**1. “Tools” [4] Configuration:** I am using `Set multiple variables` to create “clean” variables. My formulas look like this (as per my last attempt):

- **`nomeLimpo`** = `{{replace(replace(stripHTML(toString(ifempty(1.name; ""))), lf, space), cr, space)}}`

- **`necessidadeLimpa`** = `{{replace(replace(stripHTML(toString(ifempty(1.cf_qual_sua_principal_necessidade; ""))), lf, space), cr, space)}}`

- _(…and so on for all other text fields)_

**2. “HTTP” [2] Configuration:** My JSON `Request content` correctly uses the “clean” variables from the Tools module:

{  
“nomeLead”: “{{4.nomeLimpo}}”,  
“contatos”: [{  
“Problemaenfrentado”: “{{4.necessidadeLimpa}}”,  
“Necessidade”: “{{4.necessidadeLimpa}}”  
}],  
“contato”: {  
“nomeContato”: “{{4.nomeLimpo}}”  
}  
}

**The Problem:** Even with this 3-module setup, the `code 10` error **still happens** on the HTTP module.

This means that my formula in the “Tools” module (`replace(..., lf, space)`) is **failing to remove the newline character**. The “dirty” data with the `code 10` is somehow still being passed to the HTTP module.

We’ve confirmed the `Tools` module formulas are saving correctly (using `space` instead of `" "` which was being deleted by the UI).

Why would `replace(..., lf, space)` not remove the `code 10` newline character? Is there a more powerful function or a different approach to sanitize this string _before_ the HTTP module tries to build the JSON?

Thank you for any help! This bug is incredibly persistent.

 ![Screenshot 2025-10-31 16.34.01](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/8/a/8ac9c5c404e5a74d20f3de3cf889d7d347e14ee5.png)

---

<div class="post-metadata">

**Author:** ![llirik](https://avatars.discourse-cdn.com/v4/letter/l/ba9def/32.png) [@llirik](https://community.make.com/u/llirik)\
**Post date:** [November 3, 2025, 8:18am UTC](https://community.make.com/t/jsonmappingexception-ctrl-char-code-10-replace-lf-space-failing-to-remove-newline-from-string/95371/3 "2025-11-03T08:18:54Z")

</div>

Hi there,

If the output JSON uses “\n” to indicate a new line, you should simply replace it with a space character.

You can use the {{replace()}} function to achieve this. For example, you can use **{{replace(1.cf\_qual\_sua\_principal\_necessidade; “\n”; space)}}**.

Important: Please note that you should not write “space” directly. Instead, select it from the Text and Binary function keywords.

---

<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:** [February 1, 2026, 8:27am UTC](https://community.make.com/t/jsonmappingexception-ctrl-char-code-10-replace-lf-space-failing-to-remove-newline-from-string/95371/4 "2026-02-01T08:27:02Z")

</div>


