# How to separate two values of an object (temperature, humidity)

**URL:** <https://discourse.nodered.org/t/how-to-separate-two-values-of-an-object-temperature-humidity/85261>\
**Category:** General\
**Created:** [6 February 2024 16:11 UTC](https://discourse.nodered.org/t/how-to-separate-two-values-of-an-object-temperature-humidity/85261 "2024-02-06T16:11:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jflopezsanchezmon](https://avatars.discourse-cdn.com/v4/letter/j/96bed5/32.png) [@jflopezsanchezmon](https://discourse.nodered.org/u/jflopezsanchezmon)\
**Post date:** [6 February 2024 16:11 UTC](https://discourse.nodered.org/t/how-to-separate-two-values-of-an-object-temperature-humidity/85261/1 "2024-02-06T16:11:47Z")

</div>

Hello, I would like to separate the two values of an object.  
I'm trying with the split node, but it doesn't work.

Thanks

 ![Screenshot_20240206_164412](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/7/c7c727b6cff236b67cd761f69cbc23f81cd239bd.png)  
 ![Screenshot_20240206_164148](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/a/2adbdcb6f6827c8f0d0ee9c6dd043289170f1f5a.png)

---

<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:** [6 February 2024 16:26 UTC](https://discourse.nodered.org/t/how-to-separate-two-values-of-an-object-temperature-humidity/85261/2 "2024-02-06T16:26:45Z")

</div>

Connect the MQTT to 2 separate change nodes (in parallel). The first one should copy payload.temoeratura to payload, other one should copy payload.humedad to payload

---

<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:** [6 February 2024 16:27 UTC](https://discourse.nodered.org/t/how-to-separate-two-values-of-an-object-temperature-humidity/85261/3 "2024-02-06T16:27:46Z")

</div>

But first ensure you need to separate them. What do you want to do that needs that?

---

<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:** [6 February 2024 16:40 UTC](https://discourse.nodered.org/t/how-to-separate-two-values-of-an-object-temperature-humidity/85261/4 "2024-02-06T16:40:18Z")

</div>

Using a split node you can copy the property name (key) to any message property you wish. You can then use that property in the switch node to route the messages.  
e.g.

```auto
[{"id":"49fed7b68e0eedad","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"my/test.topic","payload":"{\"humedad\":50,\"temperatura\":20}","payloadType":"json","x":410,"y":4920,"wires":[["417f8eab2d2c0461"]]},{"id":"417f8eab2d2c0461","type":"split","z":"d1395164b4eec73e","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"key","x":570,"y":4920,"wires":[["f8527ef2a529d4cb"]]},{"id":"f8527ef2a529d4cb","type":"switch","z":"d1395164b4eec73e","name":"","property":"key","propertyType":"msg","rules":[{"t":"eq","v":"humedad","vt":"str"},{"t":"eq","v":"temperatura","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":730,"y":4920,"wires":[["87409c24e5857a1b"],["5d5853ad82a90c3d"]]},{"id":"87409c24e5857a1b","type":"debug","z":"d1395164b4eec73e","name":"debug 2481","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":930,"y":4880,"wires":[]},{"id":"5d5853ad82a90c3d","type":"debug","z":"d1395164b4eec73e","name":"debug 2482","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":930,"y":4960,"wires":[]}]

```

Or use the `msg.parts.key` that the split node creates.  
e.g.

```auto
[{"id":"49fed7b68e0eedad","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"my/test.topic","payload":"{\"humedad\":50,\"temperatura\":20}","payloadType":"json","x":410,"y":4920,"wires":[["417f8eab2d2c0461"]]},{"id":"417f8eab2d2c0461","type":"split","z":"d1395164b4eec73e","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":570,"y":4920,"wires":[["f8527ef2a529d4cb"]]},{"id":"f8527ef2a529d4cb","type":"switch","z":"d1395164b4eec73e","name":"","property":"parts.key","propertyType":"msg","rules":[{"t":"eq","v":"humedad","vt":"str"},{"t":"eq","v":"temperatura","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":730,"y":4920,"wires":[["87409c24e5857a1b"],["5d5853ad82a90c3d"]]},{"id":"87409c24e5857a1b","type":"debug","z":"d1395164b4eec73e","name":"debug 2481","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":930,"y":4880,"wires":[]},{"id":"5d5853ad82a90c3d","type":"debug","z":"d1395164b4eec73e","name":"debug 2482","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":930,"y":4960,"wires":[]}]

```

[How to import/export a flow](https://nodered.org/docs/user-guide/editor/workspace/import-export)

---

<div class="post-metadata">

**Author:** ![jflopezsanchezmon](https://avatars.discourse-cdn.com/v4/letter/j/96bed5/32.png) [@jflopezsanchezmon](https://discourse.nodered.org/u/jflopezsanchezmon)\
**Post date:** [6 February 2024 19:22 UTC](https://discourse.nodered.org/t/how-to-separate-two-values-of-an-object-temperature-humidity/85261/5 "2024-02-06T19:22:32Z")

</div>

In order to send separated values to influxDB.

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [6 February 2024 20:40 UTC](https://discourse.nodered.org/t/how-to-separate-two-values-of-an-object-temperature-humidity/85261/6 "2024-02-06T20:40:03Z")

</div>

Why do you want to send them separately to InfluxDB? You could store them in one measurement at the same time.

Which version of InfluxDB are you using?

---

<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:** [6 May 2024 20:40 UTC](https://discourse.nodered.org/t/how-to-separate-two-values-of-an-object-temperature-humidity/85261/7 "2024-05-06T20:40:38Z")

</div>

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