The error: "Body Parameters" is no valid JSON

I started using n8n in these days.
I have a question about it.

I want to send http request.
I sent it with request body:

{
    "app": "7",
    "records": [
        {
            "updateKey": {
                "field": "A",
                "value": "B"
            },
            "record": {
                "memo": {
                    "value": "C"
                }
            }
        }
    ]
}

Then, node replied “ERROR: The data in “Body Parameters” is no valid JSON. Set Body Content Type to “RAW/Custom” for XML or other types of payloads”.
I think request body has any error but request body doesn’t have any parse error.
What is more,I sent the same http request in cURL ,then it succeeded!

Where is the error in my request body?


MEMO

version: 0.159.0

Yes, I’ve run into this issue when sending out nested JSON. The workaround is fairly simple. I wish n8n allowed you to choose which payloads to do manually so I don’t have to go through the work of creating JSON for the simpler types like headers for Content-type. Don’t forget to change the headers for this. I use this website to generate my JSON: ObjGen - Live JSON Generator
Put Content-type = text in the model definition to have it generate valid JSON for you. Hope this helps!

Copy and paste this into your n8n window to see an example of how to send it:

Thank you so much @djangelic !!

I could send request!

Awesome! Glad to hear you figured it out! Have fun!

1 Like