Hello, I've been running a node-red app that sent a string URL via an HTTP REQUEST (that also included a SHA 256 encoded signature in the headers). Now I needed to send a request that had some nested parameters (array), started getting errors, and apparently the solution is to send it JSON object. I don't know how to proceed with this new approach. Thanks for your help.

        "id": "cb5f584da001246b",
        "type": "function",
        "z": "5ef1a9875ae1c916",
        "name": "json",
        "func": "{\"account_id\": 555555,\n    \"pair\": \"USDT_BTC\",\n    \"position\": {\n        \"type\": \"buy\",\n        \"units\": {\n            \"value\": \"0.01\"\n        },\n        \"order_type\": \"market\"\n    },\n    \"take_profit\": {\n        \"enabled\": \"true\",\n        \"steps\": [\n            {\n                \"order_type\": \"market\",\n                \"price\": {\n                    \"value\": 10000,\n                    \"type\": \"bid\"\n                },\n                \"volume\": 100\n            }\n        ]\n    },\n    \"stop_loss\": {\n        \"enabled\": \"false\"\n    }\n}",
        "outputs": 1,
        "noerr": 6,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 510,
        "y": 240,
        "wires": [

A function node is used for javascript only.

You can use a template node and put the object in there, or define a variable and assign the object and return it.

const payload = {"account_id": 555555,
    "pair": "USDT_BTC",
    "position": {
        "type": "buy",
        "units": {
            "value": "0.01"
        "order_type": "market"
    "take_profit": {
        "enabled": "true",
        "steps": [
                "order_type": "market",
                "price": {
                    "value": 10000,
                    "type": "bid"
                "volume": 100
    "stop_loss": {
        "enabled": "false"

msg.payload = payload
return msg

This will produce a json result, but I suspect this will only be the beginning of your journey, if the API needs all this information, it will probably wants a POST request with various headers.

Thanks, I understand I would need to use a template node to setup the JSON structure. Is the difference between sending a string query and json body via http post request is simply the format of the url?

Could someone share an example of sending a json via http request post?

Just attach with this payload to a http request node and set it to POST and check the output

Set the payload to an object and the http node will know what to do.

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