The data in "Body Parameters" is no valid JSON - ERROR TRIGGER

Hello! I’m trying to get the error description from the ErrorTrigger node and send it to the HTTP node. However, I can’t remove quotes and other characters, which break the JSON.

Error message: The data in “Body Parameters” is no valid JSON


“phone”: “5548XXXX”,
“message”: “:red_circle: ERRO NO N8N3:\n\nWorkFlow: [ADP] ESTORNOS VIA PIX\n\nNode: Gerar Pix\n\nYour request is invalid or could not be processed by the service/n/nReason: 409 - “{"errors":[{"code":"checkout.already.requested","description":"Saque f3a148db-cf87-4289-ad7e-df1c3e029814 já solicitado"}]}””}

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

@elicamargo , the problem you are facing is has to do with the fact that the final result (which is object in nature) becomes an object with string values including quotes (") . That is, you end up with quotes inside quotes. This invalidates the syntax of the object. Try the below instead:

  "phone": "5548",
  "message": "🔴 ERRO NO N8N3:\n\nWorkFlow: {{ $ }}\n\nNode:  {{ $json.execution.lastNodeExecuted }}\n\n{{ $json.execution.error.message }}/n/nReason: {{ $json["execution"]["error"]["description"].replaceAll('"','\\"') }}"

NOTE: The child object is introduced with $json["execution"]["error"]["description"]. To fix, you would need to escape the quotes that are part of this object. This is done with help of replaceAll('"', '\\"') function.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.