Input Text Button Value into a JSON object

Hy! i am having an issue. I want to take the input value that is comming from text input and i want to store it in text field of JSON object. Is there ant solution. In short whatever i type in input node i want it to be stored in the text key of JSON object

I'm sure there is a solution but what do you mean by `the text key of JSON object``? I could interpret that many ways. Please create a object showing what you want the result to be.

Note, there are JSON strings and Javascript objects but no JSON objects

In the image you can see that in STATUSTEXT object in the key "text" i have manually written an "abc" string. What i want is that instead of manually typing a string in the text key, whatever value i type in Input text node. It should replace "abc"

You can use the mustache temple and output as a parsed json object.
e.g.

[{"id":"c58e944566ea08f7","type":"ui_text_input","z":"452103ea51141731","name":"","label":"","tooltip":"","group":"2d4fe667.28f8ba","order":17,"width":0,"height":0,"passthru":false,"mode":"text","delay":"0","topic":"topic","sendOnBlur":true,"className":"","topicType":"msg","x":240,"y":4060,"wires":[["15160b97726f7ed7"]]},{"id":"15160b97726f7ed7","type":"template","z":"452103ea51141731","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\n    \"name\":\"input name\",\n    \"parameters\": {\n        \"test\":  \"{{payload}}\"\n    }\n}","output":"json","x":440,"y":4060,"wires":[["830147a4173859b2"]]},{"id":"830147a4173859b2","type":"debug","z":"452103ea51141731","name":"debug 111","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":590,"y":4040,"wires":[]},{"id":"2d4fe667.28f8ba","type":"ui_group","name":"demo","tab":"1caa8458.b17814","order":2,"disp":true,"width":"12","collapse":false},{"id":"1caa8458.b17814","type":"ui_tab","name":"Demo","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

Template Node

{
    "name":"input name",
    "parameters": {
        "test":  "{{payload}}"
    }
}
2 Likes

It worked, thanks for the help

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