Linebreak in JSON Data causes Syntax Error

Status: Closed · Asked by AeroFi on · 0 views

AeroFi — Question ·

Hi Pabbly Experts,

I have an API returned with the following JSON response:

const response = [{"text": "This is a sample\nwith newlines\nand more."}]

However Pabbly could not process such linebreak data and results in the error:
SyntaxError: Invalid or unexpected token

Tried with Text Formatter with no avail as well.

Any pointers?

Pabblymember11 — Reply ·

Hey @AeroFi

Please provide the URL of the workflow where you encountered this issue, along with the name of the application involved and its API documentation. Your contribution will greatly assist in diagnosing and resolving the matter effectively.

Pabblymember11 — Reply ·

Can you please try using the same JS code on the online compiler once and then let us know?

Pabblymember11 — Reply ·

Hey @AeroFi

During the automation process, an error occurred in my Code step, displaying "SyntaxError: Invalid or unexpected token." To resolve this, please kindly wrap the new line "\\n" characters from your JavaScript code line breaks in `` wrapped strings won't break the syntax in JSON. This adjustment will help rectify the syntax issue and ensure smoother execution of the code.

https://forum.pabbly.com/threads/javascript-code-by-pabbly.9884/

As a result -

AeroFi — Reply ·

I might have a problem here as I cannot separate the value from the key when dealing with the response from the API.. It comes bundled together in one object.

Pabblymember11 — Reply ·

Please allow us some time, we are currently looking into it.

AeroFi — Reply ·
Please allow us some time, we are currently looking into it.

Alright sure, keep us updated.. As it constantly throw an error when the webhook trigger contains \n or \\n characters.
Pabblymember11 — Reply ·

Sure, we will let you know once we get any update on this.

AeroFi — Reply ·
Sure, we will let you know once we get any update on this.

Hi there, any update on this issue yet?
Pabblymember11 — Reply ·

Sorry for the delay, our technical team is currently looking into it.

Shall notify you with an update soon.

AeroFi — Reply ·
Sorry for the delay, our technical team is currently looking into it.

Shall notify you with an update soon.


HI @Supreme, alright thanks.. Any estimates on this bugfix? As it is impacting the customer operations and considering a change if it persists for too long...
Pabblymember11 — Reply ·

Our team is trying its best to resolve the issue, so once we get any update on the concern will let you know.

Pabblymember11 — Reply ·
HI @Supreme, alright thanks.. Any estimates on this bugfix? As it is impacting the customer operations and considering a change if it persists for too long...

We've made significant updates on our end to ensure everything works smoothly. We encourage you to give it a try from your side with your preferred conditions.

Back to all forum threads · Log in to reply