Node-RED教程-parser解析-YAML-01-将JavaScript对象转换为YAML

功能:

  • 将JavaScript对象转换为YAML

Node-RED界面:

image

调试窗口:

6b47457b78bfb826357c416b163c301

json代码下载:

[
    {
        "id": "b2b7256f9ab546bf",
        "type": "tab",
        "label": "流程 1",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "57ccc0bebae7b6bd",
        "type": "comment",
        "z": "b2b7256f9ab546bf",
        "name": "汉联工控吧 han-link.cn",
        "info": "汉联工控吧 han-link.cn\n专业工控应用领域",
        "x": 220,
        "y": 140,
        "wires": []
    },
    {
        "id": "84222b92.d65d18",
        "type": "inject",
        "z": "b2b7256f9ab546bf",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 270,
        "y": 280,
        "wires": [
            [
                "cdd1c154.3a655"
            ]
        ]
    },
    {
        "id": "7b014430.dfd94c",
        "type": "comment",
        "z": "b2b7256f9ab546bf",
        "name": "将JavaScript对象转换为YAML",
        "info": "YAML节点可以将JavaScript对象转换为YAML字符串。",
        "x": 310,
        "y": 220,
        "wires": []
    },
    {
        "id": "1cd4ad02.9a5423",
        "type": "debug",
        "z": "b2b7256f9ab546bf",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 740,
        "y": 280,
        "wires": []
    },
    {
        "id": "cdd1c154.3a655",
        "type": "template",
        "z": "b2b7256f9ab546bf",
        "name": "JS 对象",
        "field": "payload",
        "fieldType": "msg",
        "format": "json",
        "syntax": "plain",
        "template": "{\n    \"水果\" : {\n        \"种类\": \"苹果\",\n        \"价格\": 100,\n        \"网址\": \"han-link.cn\"\n    }\n}",
        "output": "json",
        "x": 430,
        "y": 280,
        "wires": [
            [
                "aaf0100b.16628"
            ]
        ]
    },
    {
        "id": "aaf0100b.16628",
        "type": "yaml",
        "z": "b2b7256f9ab546bf",
        "property": "payload",
        "name": "",
        "x": 580,
        "y": 280,
        "wires": [
            [
                "1cd4ad02.9a5423"
            ]
        ]
    },
    {
        "id": "2a7b7b8f68903a58",
        "type": "comment",
        "z": "b2b7256f9ab546bf",
        "name": "例子:YAML节点",
        "info": "",
        "x": 300,
        "y": 180,
        "wires": []
    }
]
© 版权声明
THE END
喜欢就支持一下吧
点赞14 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情图片

    暂无评论内容