Hello, I have a workflow: Webhook → Function → HTTP Request.
The Function node output looks correct in execution data, but the HTTP Request node receives empty body.
Tried: {{$json}} in Body Parameters, JSON selected.
Any ideas why this happens??
Workflow nodes often expect the data to be within an array of JSON objects, even if you’re only processing a single item. The Function node needs to return data that adheres to this input format for the next node. Modify your Function node to ensure it returns an array of objects, with your desired data nested inside a property (often named json or body).
While {{$json}} is often used to send the entire incoming JSON, if your Function node added custom properties or nested the data, you might be pointing to the wrong place. If you implemented the fix in point 1, keep {{$json}} in the Body Parameters with JSON selected. This should send the nested payload. If you need to send a specific part of the data, use the full expression, e.g., {{$json.payload}} if your data is nested deeper.
Body Type: You mentioned JSON is selected, which is correct for {{$json}}.
HTTP Method: Ensure the HTTP Method is one that allows a body, such as POST or PUT. A GET request ignores the body data.
Double-check that your HTTP Request node’s Method is set to POST or PUT.
Try the Raw Data method with {{JSON.stringify($json)}} as a last resort, but first, focus on ensuring your Function node’s output structure is correct.
Hello qa_xcn, welcome to n8n Community! I’ll try to help yaa.
Maybe there are several point you can try:
Return shape from Function must {json: {…}}. If you return a plain object, $json is empty in the next node. The example like this:
// OK
return [{ json: { a: 1, b: 2 } }];
// NOT OK (will make $json empty next node)
return [{ a: 1, b: 2 }];
To send the entire item as JSON, dont use Body Parameters. In HTTP Request:
Toggle JSON/RAW Parameters = true
In Body, set expression to {{$json}}
Method: POST/PUT/PATCH (GET ignores body)
Headers auto-set to application/json or set it manually
If you prefer Body Parameters, you must map each field explicity (e.g., name a, value: {{$json.a}}). {{$json}} as a single parameter wont serialize the whole object.
Thats all i think i can share to you, hope this will works yaa!