# How to change json property with the value in a text input node?

**URL:** <https://discourse.nodered.org/t/how-to-change-json-property-with-the-value-in-a-text-input-node/59835>\
**Category:** General\
**Created:** [14 March 2022 10:55 UTC](https://discourse.nodered.org/t/how-to-change-json-property-with-the-value-in-a-text-input-node/59835 "2022-03-14T10:55:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![thoraz](https://avatars.discourse-cdn.com/v4/letter/t/97f17d/32.png) [@thoraz](https://discourse.nodered.org/u/thoraz)\
**Post date:** [14 March 2022 10:55 UTC](https://discourse.nodered.org/t/how-to-change-json-property-with-the-value-in-a-text-input-node/59835/1 "2022-03-14T10:55:58Z")

</div>

A simple question: how to change json property with the value in a text input node? I have a button node that generates a json object to send via mqtt. Now I want to use a text input node to change the value of `data` property in the json structure.

```auto
[{"id":"06fef075728b4940","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"83ff9096c1e21e77","type":"ui_button","z":"06fef075728b4940","name":"","group":"1b214600.17935a","order":3,"width":0,"height":0,"passthru":false,"label":"Do stuff","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"{\"nodeId\":\"mqtt\",\"idMessage\":1,\"indexPacket\":1,\"totalPackets\":1,\"packetType\":\"request picture\",\"data\":\"node01\"}","payloadType":"json","topic":"topic","topicType":"msg","x":380,"y":1840,"wires":[["798a720fc67b1a65"]]},{"id":"01709def37f25a38","type":"ui_text_input","z":"06fef075728b4940","name":"","label":"","tooltip":"","group":"1b214600.17935a","order":1,"width":0,"height":0,"passthru":true,"mode":"text","delay":"100","topic":"","sendOnBlur":true,"topicType":"str","x":380,"y":1760,"wires":[[]]},{"id":"798a720fc67b1a65","type":"debug","z":"06fef075728b4940","name":"Button click debug node","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":650,"y":1840,"wires":[]},{"id":"1b214600.17935a","type":"ui_group","name":"Default","tab":"b8fb94f4.0d31d8","order":1,"disp":true,"width":"12","collapse":false},{"id":"b8fb94f4.0d31d8","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

```

How should I do?

---

<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:** [14 March 2022 11:14 UTC](https://discourse.nodered.org/t/how-to-change-json-property-with-the-value-in-a-text-input-node/59835/2 "2022-03-14T11:14:37Z")

</div>

1. Store the text entered somewhere
2. When the button is pressed
  1. get the text from "somewhere"
  2. update the payload property value

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

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/5/f5d8b5f36523e50a0656dc2fe534dd9d738df9c0.png)

  
  

> [@thoraz](#):
>
> A simple question

Indeed 🙂

I recommend watching this playlist: [Node-RED Essentials](https://www.youtube.com/playlist?list=PLyNBB9VCLmo1hyO-4fIZ08gqFcXBkHy-6). The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

---

<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:** [14 March 2022 11:54 UTC](https://discourse.nodered.org/t/how-to-change-json-property-with-the-value-in-a-text-input-node/59835/3 "2022-03-14T11:54:37Z")

</div>

Or without using context storage.

```auto
[{"id":"24e9cfc9.5955e","type":"ui_text_input","z":"bf9e1e33.030598","name":"","label":"","tooltip":"","group":"1b214600.17935a","order":1,"width":0,"height":0,"passthru":true,"mode":"text","delay":"0","topic":"","sendOnBlur":true,"className":"","topicType":"str","x":300,"y":2340,"wires":[["a5212865.bad108"]]},{"id":"a5212865.bad108","type":"change","z":"bf9e1e33.030598","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"topic","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":250,"y":2400,"wires":[["db3b6d42.211cb8"]]},{"id":"db3b6d42.211cb8","type":"ui_button","z":"bf9e1e33.030598","name":"","group":"1b214600.17935a","order":3,"width":0,"height":0,"passthru":false,"label":"Do stuff","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"{\"nodeId\":\"mqtt\",\"idMessage\":1,\"indexPacket\":1,\"totalPackets\":1,\"packetType\":\"request picture\",\"data\":\"\"}","payloadType":"json","topic":"topic","topicType":"msg","x":210,"y":2460,"wires":[["2da21935.d25aa6"]]},{"id":"2da21935.d25aa6","type":"change","z":"bf9e1e33.030598","name":"","rules":[{"t":"set","p":"payload.data","pt":"msg","to":"topic","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":2460,"wires":[["74b6408c.76684"]]},{"id":"74b6408c.76684","type":"debug","z":"bf9e1e33.030598","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":670,"y":2460,"wires":[]},{"id":"1b214600.17935a","type":"ui_group","name":"Default","tab":"b8fb94f4.0d31d8","order":1,"disp":true,"width":"12","collapse":false},{"id":"b8fb94f4.0d31d8","type":"ui_tab","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![thoraz](https://avatars.discourse-cdn.com/v4/letter/t/97f17d/32.png) [@thoraz](https://discourse.nodered.org/u/thoraz)\
**Post date:** [14 March 2022 15:25 UTC](https://discourse.nodered.org/t/how-to-change-json-property-with-the-value-in-a-text-input-node/59835/4 "2022-03-14T15:25:10Z")

</div>

> [@Steve-Mcl](#):
>
> Indeed 🙂

I know 😬 I'll take a look to your link. Thanks a lot.

---

<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:** [28 March 2022 15:25 UTC](https://discourse.nodered.org/t/how-to-change-json-property-with-the-value-in-a-text-input-node/59835/5 "2022-03-28T15:25:18Z")

</div>

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