mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	add example for YAML node
This commit is contained in:
		| @@ -0,0 +1,90 @@ | ||||
| [ | ||||
|     { | ||||
|         "id": "84222b92.d65d18", | ||||
|         "type": "inject", | ||||
|         "z": "4b63452d.672afc", | ||||
|         "name": "", | ||||
|         "props": [ | ||||
|             { | ||||
|                 "p": "payload" | ||||
|             }, | ||||
|             { | ||||
|                 "p": "topic", | ||||
|                 "vt": "str" | ||||
|             } | ||||
|         ], | ||||
|         "repeat": "", | ||||
|         "crontab": "", | ||||
|         "once": false, | ||||
|         "onceDelay": 0.1, | ||||
|         "topic": "", | ||||
|         "payload": "", | ||||
|         "payloadType": "date", | ||||
|         "x": 200, | ||||
|         "y": 180, | ||||
|         "wires": [ | ||||
|             [ | ||||
|                 "cdd1c154.3a655" | ||||
|             ] | ||||
|         ] | ||||
|     }, | ||||
|     { | ||||
|         "id": "7b014430.dfd94c", | ||||
|         "type": "comment", | ||||
|         "z": "4b63452d.672afc", | ||||
|         "name": "Convert JavaScript object to YAML", | ||||
|         "info": "YAML node can convert JavaScript object to YAML string.", | ||||
|         "x": 240, | ||||
|         "y": 120, | ||||
|         "wires": [] | ||||
|     }, | ||||
|     { | ||||
|         "id": "1cd4ad02.9a5423", | ||||
|         "type": "debug", | ||||
|         "z": "4b63452d.672afc", | ||||
|         "name": "", | ||||
|         "active": true, | ||||
|         "tosidebar": true, | ||||
|         "console": false, | ||||
|         "tostatus": false, | ||||
|         "complete": "false", | ||||
|         "statusVal": "", | ||||
|         "statusType": "auto", | ||||
|         "x": 670, | ||||
|         "y": 180, | ||||
|         "wires": [] | ||||
|     }, | ||||
|     { | ||||
|         "id": "cdd1c154.3a655", | ||||
|         "type": "template", | ||||
|         "z": "4b63452d.672afc", | ||||
|         "name": "JS object", | ||||
|         "field": "payload", | ||||
|         "fieldType": "msg", | ||||
|         "format": "json", | ||||
|         "syntax": "plain", | ||||
|         "template": "{\n    \"fruits\" : {\n        \"kind\": \"Apple\",\n        \"price\": 100,\n        \"origin\": \"Canada\"\n    }\n}", | ||||
|         "output": "json", | ||||
|         "x": 360, | ||||
|         "y": 180, | ||||
|         "wires": [ | ||||
|             [ | ||||
|                 "aaf0100b.16628" | ||||
|             ] | ||||
|         ] | ||||
|     }, | ||||
|     { | ||||
|         "id": "aaf0100b.16628", | ||||
|         "type": "yaml", | ||||
|         "z": "4b63452d.672afc", | ||||
|         "property": "payload", | ||||
|         "name": "", | ||||
|         "x": 510, | ||||
|         "y": 180, | ||||
|         "wires": [ | ||||
|             [ | ||||
|                 "1cd4ad02.9a5423" | ||||
|             ] | ||||
|         ] | ||||
|     } | ||||
| ] | ||||
| @@ -0,0 +1,90 @@ | ||||
| [ | ||||
|     { | ||||
|         "id": "ba1dab90.8d1da8", | ||||
|         "type": "inject", | ||||
|         "z": "4b63452d.672afc", | ||||
|         "name": "", | ||||
|         "props": [ | ||||
|             { | ||||
|                 "p": "payload" | ||||
|             }, | ||||
|             { | ||||
|                 "p": "topic", | ||||
|                 "vt": "str" | ||||
|             } | ||||
|         ], | ||||
|         "repeat": "", | ||||
|         "crontab": "", | ||||
|         "once": false, | ||||
|         "onceDelay": 0.1, | ||||
|         "topic": "", | ||||
|         "payload": "", | ||||
|         "payloadType": "date", | ||||
|         "x": 200, | ||||
|         "y": 360, | ||||
|         "wires": [ | ||||
|             [ | ||||
|                 "16617f26.14ced1" | ||||
|             ] | ||||
|         ] | ||||
|     }, | ||||
|     { | ||||
|         "id": "a9f97b00.57d658", | ||||
|         "type": "comment", | ||||
|         "z": "4b63452d.672afc", | ||||
|         "name": "Convert YAML to JavaScript object", | ||||
|         "info": "YAML node can convert YAML string to JavaScript object.", | ||||
|         "x": 240, | ||||
|         "y": 300, | ||||
|         "wires": [] | ||||
|     }, | ||||
|     { | ||||
|         "id": "2d0dde7e.a50082", | ||||
|         "type": "debug", | ||||
|         "z": "4b63452d.672afc", | ||||
|         "name": "", | ||||
|         "active": true, | ||||
|         "tosidebar": true, | ||||
|         "console": false, | ||||
|         "tostatus": false, | ||||
|         "complete": "false", | ||||
|         "statusVal": "", | ||||
|         "statusType": "auto", | ||||
|         "x": 690, | ||||
|         "y": 360, | ||||
|         "wires": [] | ||||
|     }, | ||||
|     { | ||||
|         "id": "16617f26.14ced1", | ||||
|         "type": "template", | ||||
|         "z": "4b63452d.672afc", | ||||
|         "name": "YAML string", | ||||
|         "field": "payload", | ||||
|         "fieldType": "msg", | ||||
|         "format": "yaml", | ||||
|         "syntax": "plain", | ||||
|         "template": "fruits:\n    kind: Apple\n    price: 100\n    origin: Canada", | ||||
|         "output": "str", | ||||
|         "x": 370, | ||||
|         "y": 360, | ||||
|         "wires": [ | ||||
|             [ | ||||
|                 "e2e4f862.f9d7d8" | ||||
|             ] | ||||
|         ] | ||||
|     }, | ||||
|     { | ||||
|         "id": "e2e4f862.f9d7d8", | ||||
|         "type": "yaml", | ||||
|         "z": "4b63452d.672afc", | ||||
|         "property": "payload", | ||||
|         "name": "", | ||||
|         "x": 530, | ||||
|         "y": 360, | ||||
|         "wires": [ | ||||
|             [ | ||||
|                 "2d0dde7e.a50082" | ||||
|             ] | ||||
|         ] | ||||
|     } | ||||
| ] | ||||
		Reference in New Issue
	
	Block a user