# Change Node - Understanding data manipulation

**URL:** https://discourse.nodered.org/t/change-node-understanding-data-manipulation/20421
**Category:** General
**Created:** [16 January 2020 03:50 UTC](https://discourse.nodered.org/t/change-node-understanding-data-manipulation/20421 "2020-01-16T03:50:56Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![patrick1](https://avatars.discourse-cdn.com/v4/letter/p/858c86/32.png) [@patrick1](https://discourse.nodered.org/u/patrick1)
#### Post date: [16 January 2020 03:50 UTC](https://discourse.nodered.org/t/change-node-understanding-data-manipulation/20421/1 "2020-01-16T03:50:56Z")

</div>

I am pretty sure this is a simple question, I just can't wrap my head around JSON or expression to get it to do what I want. And I havent found a post or information on the node to help me.

I have successfully input MQTT message from Topic "tasmota1/stat/RESULT" and output it to "tasmota2/cmnd/Dimmer"

Thats half of what I need. The problem is the payload is

{"POWER":"ON","Dimmer":70}

This gets read in and sent out. I need to only send the number. the "Dimmer": value will be 10-100.

Can someone help me understand how to delete out everything but the number at the end? The flow should look like

MQTT in  
tasmota1/stat/RESULT  
{"POWER":"ON","Dimmer":50}  
Change to  
tasmota2/cmnd/Dimmer  
50  
MQTT out

If it is possible to split the message I could get rid of my Change State node that turns on/off Dimm2 if Dimm1 is turned on/off.

MQTT in  
tasmota1/stat/RESULT  
{"POWER":"ON","Dimmer":50}  
Change to  
tasmota2/cmnd/POWER  
ON  
tasmota2/cmnd/Dimmer  
50  
MQTT out

Any help would be greatly welcomed!  
Thanks

---

<div class="post-metadata">

### Author: ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)
#### Post date: [16 January 2020 06:43 UTC](https://discourse.nodered.org/t/change-node-understanding-data-manipulation/20421/2 "2020-01-16T06:43:26Z")

</div>

Example flow (includes a switch node to filter for the power on/off):

```auto
[{"id":"d27bb630.688b48","type":"change","z":"eb446011.5548a","name":"","rules":[{"t":"move","p":"payload.Dimmer","pt":"msg","to":"payload","tot":"msg"},{"t":"change","p":"topic","pt":"msg","from":"tasmota1/stat/RESULT","fromt":"str","to":"tasmota2/cmnd/Dimmer","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":536,"y":240,"wires":[["5708c750.d0c9f"]]},{"id":"59aaf8d8.614a88","type":"inject","z":"eb446011.5548a","name":"","topic":"tasmota1/stat/RESULT","payload":"{\"POWER\":\"ON\",\"Dimmer\":70}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":146,"y":264,"wires":[["240be2f9.07e63e"]]},{"id":"5708c750.d0c9f","type":"debug","z":"eb446011.5548a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":722,"y":240,"wires":[]},{"id":"240be2f9.07e63e","type":"switch","z":"eb446011.5548a","name":"Power ON/OFF ?","property":"payload.POWER","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"},{"t":"eq","v":"OFF","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":330,"y":264,"wires":[["d27bb630.688b48"],[]]}]

```

Use a change node:

 ![Screenshot 2020-01-16 at 07.43.01](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/b/5bf393bd79e12d1b06a0cda0740281e32b774832.jpeg)

Read the documentation on [how to work with messages](https://nodered.org/docs/user-guide/messages)

---

<div class="post-metadata">

### Author: ![patrick1](https://avatars.discourse-cdn.com/v4/letter/p/858c86/32.png) [@patrick1](https://discourse.nodered.org/u/patrick1)
#### Post date: [16 January 2020 20:18 UTC](https://discourse.nodered.org/t/change-node-understanding-data-manipulation/20421/3 "2020-01-16T20:18:30Z")

</div>

Thank you so much for your extremely fast response. You made more progress in 3 hours than I did in weeks. Thanks for the reading, I hope to get to it today.

I have been busy today so didnt really get to test it, but it doesn't work. Your well written response sends object and apparently my dimmer sends string. I am sure I can figure it out and make yours work with just a click of the button, just didnt have time to get into it today.

Thanks again for your very simple flow. It is smaller and more powerful than what I was able to make.

---

<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: [16 January 2020 20:40 UTC](https://discourse.nodered.org/t/change-node-understanding-data-manipulation/20421/4 "2020-01-16T20:40:35Z")

</div>

the MQTT in node can be configured to deliver either a string or a parsed object....
