# How to combine two objects data with one same variable value

**URL:** https://discourse.nodered.org/t/how-to-combine-two-objects-data-with-one-same-variable-value/71070
**Category:** General
**Tags:** function-node
**Created:** [22 November 2022 18:01 UTC](https://discourse.nodered.org/t/how-to-combine-two-objects-data-with-one-same-variable-value/71070 "2022-11-22T18:01:32Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![XXXperience777](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/xxxperience777/32/71210_2.png) [@XXXperience777](https://discourse.nodered.org/u/XXXperience777)
#### Post date: [22 November 2022 18:01 UTC](https://discourse.nodered.org/t/how-to-combine-two-objects-data-with-one-same-variable-value/71070/1 "2022-11-22T18:01:32Z")

</div>

Hi, I'm new to both nodered and javascript.

I have two data objects retrieved from two sources. For example, msg.payload1 describe the location of the place and msg.payload2 describes the temperature around the place.

I want to **combine the objects with the same place name so that the new data object consists of both the location and temperature.**

for example,

 ![IMG_7579](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/7/27acb1af4ee7c3cd4f3313fa5f375f9fc99652f0.jpeg)

I used the join node, the flow is:

 ![Screen Shot 2022-11-23 at 1.52.20 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/9/59b1068f50531c9b189dac3acb4b3a01f40a5057.png)

But I can't merge the object with the same "place name".

How can I do that?

Thank you so much!

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [22 November 2022 20:19 UTC](https://discourse.nodered.org/t/how-to-combine-two-objects-data-with-one-same-variable-value/71070/2 "2022-11-22T20:19:39Z")

</div>

What do you want the result to look like?

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [22 November 2022 20:33 UTC](https://discourse.nodered.org/t/how-to-combine-two-objects-data-with-one-same-variable-value/71070/3 "2022-11-22T20:33:38Z")

</div>

[This article in the cookbook](https://cookbook.nodered.org/basic/join-streams) is an example of how to join messages into one object using key/value mode, which I think will do what you want.

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [22 November 2022 21:33 UTC](https://discourse.nodered.org/t/how-to-combine-two-objects-data-with-one-same-variable-value/71070/4 "2022-11-22T21:33:49Z")

</div>

Is there any reason not to do these things in series, and just extend the msg object at each step ?

---

<div class="post-metadata">

### Author: ![XXXperience777](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/xxxperience777/32/71210_2.png) [@XXXperience777](https://discourse.nodered.org/u/XXXperience777)
#### Post date: [23 November 2022 02:41 UTC](https://discourse.nodered.org/t/how-to-combine-two-objects-data-with-one-same-variable-value/71070/5 "2022-11-23T02:41:40Z")

</div>

because the two data objects are got from two different APIs by HTTP request node, I don't know how to extend them. Is there any method?

---

<div class="post-metadata">

### Author: ![XXXperience777](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/xxxperience777/32/71210_2.png) [@XXXperience777](https://discourse.nodered.org/u/XXXperience777)
#### Post date: [23 November 2022 02:43 UTC](https://discourse.nodered.org/t/how-to-combine-two-objects-data-with-one-same-variable-value/71070/6 "2022-11-23T02:43:18Z")

</div>

the result is just like the image named"after combine". I want the object with same "place" to merge tgt, so the attributes can extend

---

<div class="post-metadata">

### Author: ![XXXperience777](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/xxxperience777/32/71210_2.png) [@XXXperience777](https://discourse.nodered.org/u/XXXperience777)
#### Post date: [23 November 2022 02:47 UTC](https://discourse.nodered.org/t/how-to-combine-two-objects-data-with-one-same-variable-value/71070/7 "2022-11-23T02:47:05Z")

</div>

thank you, but this example only handles the inject node. In my problem, I first get 2 objects from 2 APIs by using the HTTP request node, then I put the obtained data object in a function node to retrieve the attributes I needed. Then, I want to combine 2 objects from 2 payloads.

Could you please give me some examples on how to do that?

Thank you so much

---

<div class="post-metadata">

### Author: ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)
#### Post date: [23 November 2022 02:53 UTC](https://discourse.nodered.org/t/how-to-combine-two-objects-data-with-one-same-variable-value/71070/8 "2022-11-23T02:53:39Z")

</div>

What does the output of your join node look like?  
Copy and paste the data rather than a picture please!

---

<div class="post-metadata">

### Author: ![XXXperience777](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/xxxperience777/32/71210_2.png) [@XXXperience777](https://discourse.nodered.org/u/XXXperience777)
#### Post date: [23 November 2022 03:15 UTC](https://discourse.nodered.org/t/how-to-combine-two-objects-data-with-one-same-variable-value/71070/9 "2022-11-23T03:15:22Z")

</div>

Here is the flow.

I have two data objects get from two APIs. Object 1 returns the payload1, and has 5 attributes. Object 2 returns the payload2 and has 2 attributes. Both objects 1 and 2 have the same attribute "place". I want to merge the object when they have the same value of "place". So the final data object will have 6 attributes (because the "place" is same).

How can I do it? Thank you so much!

```auto
[
    {
        "id": "3c5de79e.539108",
        "type": "tab",
        "label": "flow 1",
        "disabled": true,
        "info": ""
    },
    {
        "id": "eb9b21ca8f6c20f9",
        "type": "http request",
        "z": "3c5de79e.539108",
        "name": "",
        "method": "GET",
        "ret": "obj",
        "paytoqs": "ignore",
        "url": "https://www.geodetic.gov.hk/lpapi/?db=all",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 270,
        "y": 180,
        "wires": [
            [
                "4ee93f399d7d6d1f",
                "a1f436e1f8831be3"
            ]
        ]
    },
    {
        "id": "679763c87210febb",
        "type": "inject",
        "z": "3c5de79e.539108",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "600",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 90,
        "y": 180,
        "wires": [
            [
                "eb9b21ca8f6c20f9",
                "fc28f3aa6bf7f897"
            ]
        ]
    },
    {
        "id": "4ee93f399d7d6d1f",
        "type": "split",
        "z": "3c5de79e.539108",
        "name": "",
        "splt": "\\n",
        "spltType": "str",
        "arraySplt": 1,
        "arraySpltType": "len",
        "stream": false,
        "addname": "",
        "x": 450,
        "y": 180,
        "wires": [
            [
                "85fc228bc02bcce5"
            ]
        ]
    },
    {
        "id": "a1f436e1f8831be3",
        "type": "debug",
        "z": "3c5de79e.539108",
        "name": "check object",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 290,
        "y": 80,
        "wires": []
    },
    {
        "id": "85fc228bc02bcce5",
        "type": "loop",
        "z": "3c5de79e.539108",
        "name": "",
        "kind": "fcnt",
        "count": "",
        "initial": "",
        "step": "1",
        "condition": "",
        "conditionType": "js",
        "when": "before",
        "enumeration": "enum",
        "enumerationType": "msg",
        "limit": "",
        "loopPayload": "loop-index",
        "finalPayload": "final-last",
        "x": 630,
        "y": 180,
        "wires": [
            [
                "0a7d2f8b690e2662"
            ],
            [
                "0a7d2f8b690e2662"
            ]
        ]
    },
    {
        "id": "0a7d2f8b690e2662",
        "type": "function",
        "z": "3c5de79e.539108",
        "name": "getname",
        "func": "var lampLocation = {\n payload:{\n name: msg.payload.LP_NUM,\n north: msg.payload.LP_NORTH,\n east: msg.payload.LP_EAST,\n gl: msg.payload.LP_GL,\n lat: msg.payload.LP_LAT,\n lon: msg.payload.LP_LONG,\n }\n};\n\nflow.set('lampLocation', lampLocation.payload);\n\nreturn lampLocation;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 880,
        "y": 180,
        "wires": [
            [
                "f6e5883a426a47ee"
            ]
        ]
    },
    {
        "id": "f6e5883a426a47ee",
        "type": "debug",
        "z": "3c5de79e.539108",
        "name": "check getLocation",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 910,
        "y": 280,
        "wires": []
    },
    {
        "id": "fc28f3aa6bf7f897",
        "type": "http request",
        "z": "3c5de79e.539108",
        "name": "",
        "method": "GET",
        "ret": "obj",
        "paytoqs": "ignore",
        "url": "https://www.hko.gov.hk/common/hko_data/R3/files/smart_lamppost_met_device_location.json",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 330,
        "y": 580,
        "wires": [
            [
                "66a9628cfafd3360"
            ]
        ]
    },
    {
        "id": "66a9628cfafd3360",
        "type": "split",
        "z": "3c5de79e.539108",
        "name": "",
        "splt": "\\n",
        "spltType": "str",
        "arraySplt": 1,
        "arraySpltType": "len",
        "stream": false,
        "addname": "",
        "x": 510,
        "y": 580,
        "wires": [
            [
                "bceabcb6ef9c199e",
                "b9fa71faa1beab3c"
            ]
        ]
    },
    {
        "id": "bceabcb6ef9c199e",
        "type": "loop",
        "z": "3c5de79e.539108",
        "name": "",
        "kind": "fcnt",
        "count": "",
        "initial": "",
        "step": "1",
        "condition": "",
        "conditionType": "js",
        "when": "before",
        "enumeration": "enum",
        "enumerationType": "msg",
        "limit": "",
        "loopPayload": "loop-index",
        "finalPayload": "final-last",
        "x": 730,
        "y": 580,
        "wires": [
            [
                "9bbe6f75b3d0e07c"
            ],
            [
                "9bbe6f75b3d0e07c"
            ]
        ]
    },
    {
        "id": "b9fa71faa1beab3c",
        "type": "debug",
        "z": "3c5de79e.539108",
        "name": "check lamp type object",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 510,
        "y": 500,
        "wires": []
    },
    {
        "id": "9bbe6f75b3d0e07c",
        "type": "function",
        "z": "3c5de79e.539108",
        "name": "getIDType",
        "func": "return {\n payload: {\n lamppost_id: msg.payload.LP_NUMBER,\n lamppost_type: msg.payload.LP_TYPE,\n lat: msg.payload.LP_LATITUDE,\n lon: msg.payload.LP_LONGITUDE\n }\n};",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 920,
        "y": 580,
        "wires": [
            [
                "44d012a392194a77",
                "3390fbfd129e6e6c"
            ]
        ]
    },
    {
        "id": "44d012a392194a77",
        "type": "switch",
        "z": "3c5de79e.539108",
        "name": "getDeviceID",
        "property": "payload.lamppost_type",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "01",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "02",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 1130,
        "y": 580,
        "wires": [
            [
                "47645c984b40cd47"
            ],
            [
                "9a7105c941f5a1d0"
            ]
        ]
    },
    {
        "id": "3390fbfd129e6e6c",
        "type": "debug",
        "z": "3c5de79e.539108",
        "name": "check idtype",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 930,
        "y": 500,
        "wires": []
    },
    {
        "id": "47645c984b40cd47",
        "type": "function",
        "z": "3c5de79e.539108",
        "name": "getIDType",
        "func": "return {\n payload: {\n lamppost_id: msg.payload.lamppost_id,\n lamppost_type: msg.payload.lamppost_type,\n lat: msg.payload.lat,\n lon: msg.payload.lon,\n device_id: \"01\"\n }\n};",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1320,
        "y": 540,
        "wires": [
            [
                "6d629b022f73577e",
                "71402cdd2b25df5f"
            ]
        ]
    },
    {
        "id": "9a7105c941f5a1d0",
        "type": "function",
        "z": "3c5de79e.539108",
        "name": "getIDType",
        "func": "return {\n payload: {\n lamppost_id: msg.payload.lamppost_id,\n lamppost_type: msg.payload.lamppost_type,\n lat: msg.payload.lat,\n lon: msg.payload.lon,\n device_id: \"04\"\n }\n};",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1320,
        "y": 600,
        "wires": [
            [
                "bf617086f0d43abc",
                "71402cdd2b25df5f"
            ]
        ]
    },
    {
        "id": "6d629b022f73577e",
        "type": "debug",
        "z": "3c5de79e.539108",
        "name": "check deviceID01",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1250,
        "y": 440,
        "wires": []
    },
    {
        "id": "71402cdd2b25df5f",
        "type": "loop",
        "z": "3c5de79e.539108",
        "name": "",
        "kind": "fcnt",
        "count": "",
        "initial": "",
        "step": "1",
        "condition": "",
        "conditionType": "js",
        "when": "before",
        "enumeration": "enum",
        "enumerationType": "msg",
        "limit": "",
        "loopPayload": "loop-index",
        "finalPayload": "final-last",
        "x": 1530,
        "y": 560,
        "wires": [
            [
                "e7c7f72a8a5e93e4"
            ],
            [
                "e7c7f72a8a5e93e4"
            ]
        ]
    },
    {
        "id": "bf617086f0d43abc",
        "type": "debug",
        "z": "3c5de79e.539108",
        "name": "check deviceID04",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1450,
        "y": 700,
        "wires": []
    },
    {
        "id": "e7c7f72a8a5e93e4",
        "type": "function",
        "z": "3c5de79e.539108",
        "name": "setRequestForAllData",
        "func": "// @ts-nocheck\nvar msg ={\n method:'GET',\n url: 'https://data.weather.gov.hk/weatherAPI/smart-lamppost/smart-lamppost.php?pi=' + msg.payload.lamppost_id + '&di=' + msg.payload.device_id,\n};\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1760,
        "y": 560,
        "wires": [
            [
                "a58ee1054e651ddb"
            ]
        ]
    },
    {
        "id": "a58ee1054e651ddb",
        "type": "http request",
        "z": "3c5de79e.539108",
        "name": "",
        "method": "use",
        "ret": "obj",
        "paytoqs": "ignore",
        "url": "",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 1970,
        "y": 560,
        "wires": [
            [
                "c08569e42cc92766",
                "41d9300f3bf28ae6"
            ]
        ]
    },
    {
        "id": "c08569e42cc92766",
        "type": "debug",
        "z": "3c5de79e.539108",
        "name": "check get request",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 2010,
        "y": 640,
        "wires": []
    },
    {
        "id": "41d9300f3bf28ae6",
        "type": "function",
        "z": "3c5de79e.539108",
        "name": "getPI",
        "func": "var lampInfo = { \n payload: {\n PI: msg.payload.PI,\n humdity: msg.payload.BODY.HKO.RH,\n // temp:msg.payload.BODY.HKO.TO\n }\n};\nflow.set('lampInfo', lampInfo.payload);\n\nreturn lampInfo;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 2150,
        "y": 560,
        "wires": [
            [
                "438bb9b3f164358c"
            ]
        ]
    },
    {
        "id": "438bb9b3f164358c",
        "type": "debug",
        "z": "3c5de79e.539108",
        "name": "check getInfo",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 2280,
        "y": 620,
        "wires": []
    }
]

```

---

<div class="post-metadata">

### Author: ![XXXperience777](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/xxxperience777/32/71210_2.png) [@XXXperience777](https://discourse.nodered.org/u/XXXperience777)
#### Post date: [23 November 2022 03:16 UTC](https://discourse.nodered.org/t/how-to-combine-two-objects-data-with-one-same-variable-value/71070/10 "2022-11-23T03:16:25Z")

</div>

Hi I put the flow here, could you please check and help me? thank you

---

<div class="post-metadata">

### Author: ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)
#### Post date: [23 November 2022 03:41 UTC](https://discourse.nodered.org/t/how-to-combine-two-objects-data-with-one-same-variable-value/71070/11 "2022-11-23T03:41:20Z")

</div>

You have posted _photos_ of two payloads which together give the latitude, longitude, temperature and humidity at Repulse Bay Beach.

After your join node, these will be combined into a single payload, and it _ought to be_ a simple task to create a new message with all the elements.

However, _I suspect_ that your real data may be much more complex, in particular it may contain values for multiple places, making things a little more complicated.

So I asked you to share some of your real data; you haven't.

---

<div class="post-metadata">

### Author: ![XXXperience777](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/xxxperience777/32/71210_2.png) [@XXXperience777](https://discourse.nodered.org/u/XXXperience777)
#### Post date: [23 November 2022 04:09 UTC](https://discourse.nodered.org/t/how-to-combine-two-objects-data-with-one-same-variable-value/71070/12 "2022-11-23T04:09:40Z")

</div>

My real data is get from the API, which is the real-time updated data.

I shared the flow with you, you can import the flow, and my real data is retrieved from the "HTTP request" node.

please kindly open the flow I just post 🙂

---

<div class="post-metadata">

### Author: ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)
#### Post date: [23 November 2022 08:20 UTC](https://discourse.nodered.org/t/how-to-combine-two-objects-data-with-one-same-variable-value/71070/13 "2022-11-23T08:20:35Z")

</div>

> [@XXXperience777](#):
>
> please kindly open the flow I just post 🙂

I did that.

1. The flow is disabled.
2. It contains nodes which are not installed in my palette, so I cannot run it.
3. If I take just the initial inject and HTTP request nodes I get this:  
 ![Untitled 1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/9/f9453f3a5d6d00839e8ac11be678ffbe32f275e7.jpeg)

---

<div class="post-metadata">

### Author: ![ralphwetzel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ralphwetzel/32/53713_2.png) [@ralphwetzel](https://discourse.nodered.org/u/ralphwetzel)
#### Post date: [23 November 2022 08:55 UTC](https://discourse.nodered.org/t/how-to-combine-two-objects-data-with-one-same-variable-value/71070/14 "2022-11-23T08:55:42Z")

</div>

> [@XXXperience777](#):
>
> please kindly open the flow I just post 🙂

I did - and even installed the contrib-loop node. Unfortunately, your flow doesn't show the issue you have. There's a structure that looks similar...

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/4/a4b5b74e839efd79326f16a696bae2c629d4d429.png)

... but it's not trying to perform the task you indicated.  
I have an impression of what you try to achieve - yet to support further, there's a better starting point necessary...

---

<div class="post-metadata">

### Author: ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)
#### Post date: [23 November 2022 08:59 UTC](https://discourse.nodered.org/t/how-to-combine-two-objects-data-with-one-same-variable-value/71070/15 "2022-11-23T08:59:55Z")

</div>

You need to move the data from first request to preserve it for the end, if you check the end debug output all the info is there and can be manipulated at the end.

```auto
[{"id":"679763c87210febb","type":"inject","z":"3c5de79e.539108","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":240,"wires":[["fc28f3aa6bf7f897"]]},{"id":"fc28f3aa6bf7f897","type":"http request","z":"3c5de79e.539108","name":"","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://www.hko.gov.hk/common/hko_data/R3/files/smart_lamppost_met_device_location.json","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":290,"y":280,"wires":[["b9fa71faa1beab3c","66a9628cfafd3360"]]},{"id":"b9fa71faa1beab3c","type":"debug","z":"3c5de79e.539108","name":"check lamp type object","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":440,"y":400,"wires":[]},{"id":"66a9628cfafd3360","type":"split","z":"3c5de79e.539108","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":470,"y":280,"wires":[["9bbe6f75b3d0e07c"]]},{"id":"9bbe6f75b3d0e07c","type":"function","z":"3c5de79e.539108","name":"getIDType","func":"msg.method = 'GET',\nmsg.url = 'https://data.weather.gov.hk/weatherAPI/smart-lamppost/smart-lamppost.php?pi=' + msg.payload.LP_NUMBER + '&di=' + msg.payload.LP_TYPE;\nmsg.lamp_post = msg.payload;\nreturn msg\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":640,"y":320,"wires":[["a58ee1054e651ddb"]]},{"id":"a58ee1054e651ddb","type":"http request","z":"3c5de79e.539108","name":"","method":"use","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":810,"y":360,"wires":[["438bb9b3f164358c"]]},{"id":"438bb9b3f164358c","type":"debug","z":"3c5de79e.539108","name":"check getInfo","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1100,"y":420,"wires":[]}]

```

---

<div class="post-metadata">

### Author: ![XXXperience777](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/xxxperience777/32/71210_2.png) [@XXXperience777](https://discourse.nodered.org/u/XXXperience777)
#### Post date: [23 November 2022 10:31 UTC](https://discourse.nodered.org/t/how-to-combine-two-objects-data-with-one-same-variable-value/71070/16 "2022-11-23T10:31:50Z")

</div>

thank you so much! it works!

---

<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: [7 December 2022 10:32 UTC](https://discourse.nodered.org/t/how-to-combine-two-objects-data-with-one-same-variable-value/71070/17 "2022-12-07T10:32:47Z")

</div>

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