Manipulate JSON data

hi,
im sending data in JSON format into an enoceanoutput node. ther is a string represtentes 4 bytes of data. for example: "data": "32000008", first byte contains setpoint in hexformat, other bytes contains settinginfos, etc..

how can i manipulate this fist byte for example to set setpoint by dasboard input

Capture

thanks for any response

Here are 3 examples of how it is possible

[{"id":"0a72b705c7d2788a","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"22","payloadType":"str","x":130,"y":1060,"wires":[["f28bbe5d66215e8f","7a4c9438618b8f57","2f8109fb1cad39b3"]]},{"id":"f28bbe5d66215e8f","type":"template","z":"d1395164b4eec73e","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\n    \"meta\":{},\n    \"data\": \"{{payload}}000000\"\n}","output":"json","x":320,"y":1060,"wires":[["da2945f704a24adf"]]},{"id":"7a4c9438618b8f57","type":"function","z":"d1395164b4eec73e","name":"function 146","func":"msg.payload = {\n    \"meta\":{},\n    \"data\": msg.payload + \"000000\"\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":330,"y":1100,"wires":[["c13fe6e024caf81d"]]},{"id":"2f8109fb1cad39b3","type":"change","z":"d1395164b4eec73e","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":" {\t    \"meta\":{},\t    \"data\": $$.payload & \"000000\"\t}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":1160,"wires":[["2af232e92f908e65"]]},{"id":"6a65d904b2c178c1","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"32","payloadType":"str","x":130,"y":1100,"wires":[["f28bbe5d66215e8f","7a4c9438618b8f57","2f8109fb1cad39b3"]]},{"id":"da2945f704a24adf","type":"debug","z":"d1395164b4eec73e","name":"debug 2453","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":530,"y":1060,"wires":[]},{"id":"c13fe6e024caf81d","type":"debug","z":"d1395164b4eec73e","name":"debug 2454","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":530,"y":1100,"wires":[]},{"id":"2af232e92f908e65","type":"debug","z":"d1395164b4eec73e","name":"debug 2455","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":530,"y":1160,"wires":[]}]
1 Like

:+1: thanks

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