Skip to main content

Hi Guys,

I'm encountering an issue when sending an API request from ManyChat. My JSON structure is as follows:

{  "email": "{{email}}",  "lead_name": "{{cuf_12637843}}",  "book_title": "{{cuf_12637849}}",  "book_price": "{{cuf_12637847}}",  "book_notes": "{{cuf_12637844}}",  "items_rlated": "{{cuf_12637845}}"}

 

 

if i am removing the last line   "items_rlated": "{{cuf_12637845}}" it’s working great! but i dont know what is the issue in cuf_12637845 that i can’t save this json

if i am replcing “cuf_12637845” with “testing” its working, so i guess it’s something related to the field (its a custom text field)

 

 

ERROR I GOT:

Invalid payload json
 

Invalid JSON

Bad control character in string literal in JSON at position 185 (line 7 column 38)

 

 

Click on this custom field that has an error and enable the "Encode to JSON" option. This may solve your problem.


STILL THE SAME ISSUE

I Have tried to maek this as “Encode to json” but still the same issue

 


Your structure is correct. You need to analyze the type of content in this custom field. Generally, when it is of type text or number and you enable the 'JSON encode' option, it works fine. Therefore, there may be some special character in your text that is causing this issue.


hi ​@AmitShemla did you manage to fix the issue?


@Raquel C hi

no...


Hey ​@AmitShemla did you try the "Encode to JSON" option that ​@rogerioaraujo suggested?

For this to work, you need to check "Encode to JSON" and remove the " " from the JSON code.

If looks like this if you do all text:

{
   "test": {{cuf_11290063|to_json:true}}
}

 

In your case, it'll look like this:

{  "email": "{{email}}",  "lead_name": "{{cuf_12637843}}",  "book_title": "{{cuf_12637849}}",  "book_price": "{{cuf_12637847}}",  "book_notes": "{{cuf_12637844}}",  "items_rlated": {{cuf_12637845|to_json:true}} }

 

The reason for this is that the content of your custom field likely has some characters that need to be escaped to work on the JSON body (characters like /, ", and such). When you remove the " " and do the encode to JSON, Manychat will automatically escape the characters, and it should work.

 


Reply