You want to convert a message property between a YAML string and the JavaScript object it represents.
The YAML
node can be used to convert between the two
formats.
[{"id":"f231967.0251a68","type":"inject","z":"64133d39.bb0394","name":"YAML String","topic":"","payload":"{\"a\":1}","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":320,"wires":[["a0110756.ecfa48"]]},{"id":"8f8f31b7.1f916","type":"debug","z":"64133d39.bb0394","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":590,"y":320,"wires":[]},{"id":"5138ba3.c972444","type":"inject","z":"64133d39.bb0394","name":"Object","topic":"","payload":"{\"a\":1, \"b\":[1,2,3]}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":360,"wires":[["2fa653cc.60d3dc"]]},{"id":"50f2f4c.4a6e60c","type":"debug","z":"64133d39.bb0394","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":430,"y":360,"wires":[]},{"id":"a0110756.ecfa48","type":"template","z":"64133d39.bb0394","name":"","field":"payload","fieldType":"msg","format":"yaml","syntax":"plain","template":"a: 1\nb:\n - 1\n - 2\n - 3","output":"str","x":280,"y":320,"wires":[["104b80e2.51068f"]]},{"id":"2fa653cc.60d3dc","type":"yaml","z":"64133d39.bb0394","property":"payload","name":"","x":250,"y":360,"wires":[["50f2f4c.4a6e60c"]]},{"id":"104b80e2.51068f","type":"yaml","z":"64133d39.bb0394","property":"payload","name":"","x":430,"y":320,"wires":[["8f8f31b7.1f916"]]}]
In the example, the first flow injects the YAML:
a: 1
b:
- 1
- 2
- 3
The YAML
node then converts it to the equivalent JavaScript
object.
The second flow does the reverse, injecting the object { a: 1, b: [1,2,3] }
and converting it to YAML.
Node-RED: Low-code programming for event-driven applications.
Copyright OpenJS Foundation and Node-RED contributors. All rights reserved. The OpenJS Foundation has registered trademarks and uses trademarks. For a list of trademarks of the OpenJS Foundation, please see our Trademark Policy and Trademark List. Trademarks and logos not indicated on the list of OpenJS Foundation trademarks are trademarks™ or registered® trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.
The OpenJS Foundation | Terms of Use | Privacy Policy | OpenJS Foundation Bylaws | Trademark Policy | Trademark List | Cookie Policy
益生菌的食物是什么 | 火召是什么字 | 人为什么要生孩子 | 苏菲是什么 | rt是什么 |
为什么洗澡后皮肤会痒 | 什么人不能吃海参 | 独守空房是什么意思 | 尾椎骨疼痛是什么原因 | 牙龈出血吃什么药 |
为什么会流鼻血什么原因引起的 | 半夜饿是什么原因 | 胀气吃什么 | 7月份有什么节日吗 | 原味是什么意思 |
平安夜什么时候吃苹果 | 感冒吃什么食物好得快 | 三点水一个前读什么 | 骨质硬化是什么意思 | 20度穿什么 |
抗甲状腺球蛋白抗体高是什么意思hcv9jop2ns0r.cn | 防弹衣为什么能防弹hcv9jop5ns4r.cn | 吃什么水果能美白hcv8jop8ns9r.cn | 1970属什么生肖hcv7jop6ns9r.cn | soso是什么意思hcv9jop3ns4r.cn |
小孩腹泻吃什么药好得快xianpinbao.com | 屈打成招是什么意思hcv9jop0ns5r.cn | 今年为什么有两个6月hcv8jop5ns7r.cn | 胃炎吃什么药效果最好hcv7jop6ns1r.cn | 洋葱什么时候收获hcv7jop6ns1r.cn |
胆红素偏高挂什么科hcv8jop2ns2r.cn | 什么好像什么造句hcv8jop9ns6r.cn | 维民所止什么意思hcv8jop9ns6r.cn | 我用什么留住你hcv7jop4ns5r.cn | 男生回复嗯嗯代表什么jinxinzhichuang.com |
金刚经讲的是什么mmeoe.com | 片反过来念什么hcv8jop5ns7r.cn | 太行山在什么地方hcv7jop6ns8r.cn | 女人什么发型最有气质hcv9jop0ns8r.cn | 马拉车是什么牌子的包hcv8jop7ns9r.cn |