# How to use RBE node with object

**URL:** <https://discourse.nodered.org/t/how-to-use-rbe-node-with-object/70767>\
**Category:** General\
**Created:** [17 November 2022 12:04 UTC](https://discourse.nodered.org/t/how-to-use-rbe-node-with-object/70767 "2022-11-17T12:04:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ketpa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ketpa/32/42496_2.png) [@ketpa](https://discourse.nodered.org/u/ketpa)\
**Post date:** [17 November 2022 12:04 UTC](https://discourse.nodered.org/t/how-to-use-rbe-node-with-object/70767/1 "2022-11-17T12:04:40Z")

</div>

I have object var a = {  
"a1": 0,  
"a2": 0,  
"a3": 0,  
"a4": 0,  
"a5": 0,  
"a6": 0,  
"a7": 1,

```
}

```

How to check changed value with RBE.  
How to create new topic for each value and send to RBE?

```auto
[
    {
        "id": "6404444bc697d3b4",
        "type": "rbe",
        "z": "77aa57dc9b449835",
        "name": "",
        "func": "rbei",
        "gap": "",
        "start": "",
        "inout": "out",
        "septopics": true,
        "property": "payload",
        "topi": "topic",
        "x": 270,
        "y": 100,
        "wires": [
            [
                "981b751314734123"
            ]
        ]
    },
    {
        "id": "e2dc086d7ccb4383",
        "type": "inject",
        "z": "77aa57dc9b449835",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "0",
        "payloadType": "num",
        "x": 90,
        "y": 60,
        "wires": [
            [
                "6404444bc697d3b4"
            ]
        ]
    },
    {
        "id": "5ab06ea56ae9e4a5",
        "type": "inject",
        "z": "77aa57dc9b449835",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "1",
        "payloadType": "num",
        "x": 90,
        "y": 120,
        "wires": [
            [
                "6404444bc697d3b4"
            ]
        ]
    },
    {
        "id": "981b751314734123",
        "type": "debug",
        "z": "77aa57dc9b449835",
        "name": "debug 398",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 410,
        "y": 100,
        "wires": []
    },
    {
        "id": "a3bd23215374c9d7",
        "type": "function",
        "z": "77aa57dc9b449835",
        "name": "function 503",
        "func": "msg.payload = {\n \"a1\": 0,\n \"a2\": 0,\n \"a3\": 0,\n \"a4\": 0,\n \"a5\": 0,\n \"a6\": 0,\n \"a7\": 0,\n \n }\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 250,
        "y": 220,
        "wires": [
            [
                "d102b09971b8fdb9"
            ]
        ]
    },
    {
        "id": "beaf3671431508ac",
        "type": "function",
        "z": "77aa57dc9b449835",
        "name": "function 504",
        "func": "msg.payload = {\n \"a1\": 0,\n \"a2\": 0,\n \"a3\": 0,\n \"a4\": 0,\n \"a5\": 0,\n \"a6\": 0,\n \"a7\": 1,\n \n }\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 250,
        "y": 280,
        "wires": [
            [
                "d102b09971b8fdb9"
            ]
        ]
    },
    {
        "id": "687f3640c739891c",
        "type": "inject",
        "z": "77aa57dc9b449835",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 100,
        "y": 220,
        "wires": [
            [
                "a3bd23215374c9d7"
            ]
        ]
    },
    {
        "id": "63c4abf560daaec9",
        "type": "inject",
        "z": "77aa57dc9b449835",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 100,
        "y": 280,
        "wires": [
            [
                "beaf3671431508ac"
            ]
        ]
    },
    {
        "id": "d102b09971b8fdb9",
        "type": "rbe",
        "z": "77aa57dc9b449835",
        "name": "",
        "func": "rbei",
        "gap": "",
        "start": "",
        "inout": "out",
        "septopics": true,
        "property": "payload",
        "topi": "topic",
        "x": 410,
        "y": 240,
        "wires": [
            [
                "2d44c67ec6a8ce4a"
            ]
        ]
    },
    {
        "id": "2d44c67ec6a8ce4a",
        "type": "debug",
        "z": "77aa57dc9b449835",
        "name": "debug 399",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 570,
        "y": 240,
        "wires": []
    }
]

```

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [17 November 2022 12:14 UTC](https://discourse.nodered.org/t/how-to-use-rbe-node-with-object/70767/2 "2022-11-17T12:14:25Z")

</div>

you could convert the object to string (pass it through a JSON node) then pass it through the RBE then pass it once more through a JSON node to convert it back to an Object.

---

<div class="post-metadata">

**Author:** ![ketpa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ketpa/32/42496_2.png) [@ketpa](https://discourse.nodered.org/u/ketpa)\
**Post date:** [17 November 2022 12:24 UTC](https://discourse.nodered.org/t/how-to-use-rbe-node-with-object/70767/3 "2022-11-17T12:24:16Z")

</div>

> [@Steve-Mcl](#):
>
> you could convert the object to string (pass it through a JSON node)

which function ?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [17 November 2022 12:58 UTC](https://discourse.nodered.org/t/how-to-use-rbe-node-with-object/70767/4 "2022-11-17T12:58:29Z")

</div>

> [@ketpa](#):
>
> which function

👇

> [@Steve-Mcl](#):
>
> pass it through a JSON node

Not sure how to say it any clearer. Perhaps my 2nd best explanation will help 😉

Pass the msg with the payload object through a JSON node (converts it to string) then through the RBE then back through the JSON node to convert it back to an object.

---

<div class="post-metadata">

**Author:** ![ketpa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ketpa/32/42496_2.png) [@ketpa](https://discourse.nodered.org/u/ketpa)\
**Post date:** [17 November 2022 13:38 UTC](https://discourse.nodered.org/t/how-to-use-rbe-node-with-object/70767/5 "2022-11-17T13:38:47Z")

</div>

Maybe I'm too newbie 🙂  
I thinking about this and it's work with RBE (Apply mode separately for each msg.topic)

```auto
for (let x in obj) {
    console.log(x + ": " + obj[x])
    node.send({
        "payload": {
            'opis': x,
            'value': obj[x]
        },
        'topic': x
    });
}

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [1 December 2022 13:39 UTC](https://discourse.nodered.org/t/how-to-use-rbe-node-with-object/70767/6 "2022-12-01T13:39:11Z")

</div>

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