I try use JSON.stringify and toString, but don't work.
Welcome to the forums @Gabriel2.
But I must state, its really not clear what your trying to achieve.
Sending /
to a function node, running it through JSON.stringify
& toString
<- unnecessary, as JSON.stringify
does exactly that! Then running that through a template node - expecting what exactly?
Please! For your benefit, provide more information on what it is you want to achieve exactly.
Example - /
is not valid JSON for starters, so is not really suitable for JSON.stringify
EDIT
If your want to actually print JSON in a template , then you need to escape it with 3 brackets, after using JSON.stringify
{{{payload}}}
I'm trying to pass a text that has "/" to a file through the 'template', but instead of getting "/" to the file it arrives /
[
{
"id": "2089aafc129801af",
"type": "template",
"z": "a124555c43bf7bf0",
"name": "",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "This is the payload: {{payload}} !",
"output": "str",
"x": 1000,
"y": 1000,
"wires": [
[
"6e1d262a16c61631"
]
]
},
{
"id": "18868541dbeae49a",
"type": "inject",
"z": "a124555c43bf7bf0",
"name": "",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "/",
"payloadType": "str",
"x": 590,
"y": 1000,
"wires": [
[
"c50542ca3d243520"
]
]
},
{
"id": "6e1d262a16c61631",
"type": "debug",
"z": "a124555c43bf7bf0",
"name": "debug 157",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1190,
"y": 1000,
"wires": []
},
{
"id": "c50542ca3d243520",
"type": "function",
"z": "a124555c43bf7bf0",
"name": "function 22",
"func": "return msg",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 810,
"y": 1000,
"wires": [
[
"2089aafc129801af"
]
]
}
]
I can't believe that was it, thank you very much.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.