# How can I split a MQTT string

**URL:** <https://discourse.nodered.org/t/how-can-i-split-a-mqtt-string/57258>\
**Category:** Developing Nodes\
**Created:** [26 January 2022 13:40 UTC](https://discourse.nodered.org/t/how-can-i-split-a-mqtt-string/57258 "2022-01-26T13:40:23Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![puba](https://avatars.discourse-cdn.com/v4/letter/p/bc79bd/32.png) [@puba](https://discourse.nodered.org/u/puba)\
**Post date:** [2 February 2022 19:01 UTC](https://discourse.nodered.org/t/how-can-i-split-a-mqtt-string/57258/6 "2022-02-02T19:01:36Z")

</div>

Hallo,

i'm back from the hospital,

Now i can copy the MQTT message :

```auto
{ Time: "2022-02-02T19:39:51", DS18B20-1: object, DS18B20-2: object, TempUnit: "C" }

```

an split:

...............

object

Time: "2022-02-02T19:39:51"  
DS18B20-1: object  
Id: "03168C0093FF"  
Temperature: 47.8

DS18B20-2: object  
Id: "03168C212DFF"  
Temperature: 46.7

TempUnit: "C"

..................

I like to extract the temperature from DS188B20-1 an from DB18B20-2 plus the time oft the  
measurement.

Attached is my previous attempt

```auto
[
{
"id": "08f3f1f3f456ef79",
"type": "tab",
"label": "Flow 3",
"disabled": false,
"info": "",
"env": []
},
{
"id": "c9e78fda7c373df6",
"type": "mqtt in",
"z": "08f3f1f3f456ef79",
"name": "",
"topic": "Heizung/Temperatur/SENSOR",
"qos": "1",
"datatype": "json",
"broker": "91280bb83b9e18be",
"nl": false,
"rap": false,
"rh": 0,
"inputs": 0,
"x": 220,
"y": 120,
"wires": [
[
"869f8c430801be9b",
"71678c95db116ff8"
]
]
},
{
"id": "e1216c6e0aa2ee2f",
"type": "json",
"z": "08f3f1f3f456ef79",
"name": "",
"property": "payload",
"action": "",
"pretty": false,
"x": 170,
"y": 400,
"wires": [
[
"6198253746a49072",
"12e0d1652cda9fc2"
]
]
},
{
"id": "6198253746a49072",
"type": "debug",
"z": "08f3f1f3f456ef79",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 330,
"y": 340,
"wires": []
},
{
"id": "869f8c430801be9b",
"type": "debug",
"z": "08f3f1f3f456ef79",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 690,
"y": 120,
"wires": []
},
{
"id": "12e0d1652cda9fc2",
"type": "change",
"z": "08f3f1f3f456ef79",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.temperature",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 440,
"y": 420,
"wires": [
[
"eccfd14eb2550e6e"
]
]
},
{
"id": "eccfd14eb2550e6e",
"type": "debug",
"z": "08f3f1f3f456ef79",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 670,
"y": 420,
"wires": []
},
{
"id": "71678c95db116ff8",
"type": "change",
"z": "08f3f1f3f456ef79",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "msg.payload.DS18B20-1",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 210,
"y": 240,
"wires": [
[
"e1216c6e0aa2ee2f",
"d429e5954526e3c9"
]
]
},
{
"id": "d429e5954526e3c9",
"type": "debug",
"z": "08f3f1f3f456ef79",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 590,
"y": 240,
"wires": []
},
{
"id": "91280bb83b9e18be",
"type": "mqtt-broker",
"name": "docker:11883",
"broker": "172.17.0.1",
"port": "11883",
"clientid": "",
"autoConnect": true,
"usetls": false,
"protocolVersion": "5",
"keepalive": "60",
"cleansession": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willPayload": "",
"willMsg": {},
"sessionExpiry": ""
}
]

```

Can you help me to eliminate the correct values?

Best Regards

Armin

---

_[View the full topic](https://discourse.nodered.org/t/how-can-i-split-a-mqtt-string/57258)._
