HTTP Post Request Successful but JSON Still Incorrect?


As in screenshot, my message sends correctly to Pumble (similar to Slack), but yet the JSON body is incorrect?

How can that be? And how do I fix this?

The response from the API is actually the problem.
Not your request.

Can you share your workflow JSON here so I can test it and help you further?
You can copy and paste it inside a code block.

To create a code block you just have to click here:
image

Your workflow will show up like this:

I’m trying to figure out where to go to copy the whole workflow as a code, sorry!

@solomon any idea?

Hi @solomon I managed to get this working and bypass the JSON body error by turning the response into text. I did this with chatgpt’s suggestion, but I actually do not know why this worked. Would you be able to explain this to me?

Hey @Shpat

The response returned by the API is probably in a bad format. Send it to ChatGPT and ask it to find the problem in the JSON.

When you receive that bad format JSON, n8n is not able to process it and turn it into a JSON object.

You can use N8N expressions to turn string into JSON, after you fix the response text. It’s called “JSON parsing” and ChatGPT will also be able to write the expression for you.

I haven’t tested your workflow yet, but I’ll do as soon as I get to my PC.

Just tested it here and I found out the response is actually pure text.
It’s not returning JSON.

By enabling the Text option and choosing a field to store the text, you turn a simple text into a JSON object.

Since the response is simple text, you have to enable the option to receive in text format. That’s why it wasn’t working before.

:point_right: If my reply answers your question, please remember to mark it as a solution.

1 Like

Thank you @solomon

1 Like

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