-
Notifications
You must be signed in to change notification settings - Fork 8
Routes: Mustache Parser
The Mustache Parser Route
The Mustache Parser route node is used to parse an mustache template using JSON object from message. ASB uses the Mustache library for this.
The Mustache parser will parse the incoming mustache template, and then produce a corresponding output document using the message content. To find out how to develop a proper Mustache template, please refer to the documentation for Mustache here
The code block below documents the format for the Mustache Parser route node.
"route1": {
"type": "mustache",
"dependencies": "route0",
"template": "c:/test/json2xml.xml"
}
The template property points to the mustache document template to be used to render the final document.
The message.content
of the incoming message must be a Javascript object and this is used to render the template.
The code block below illustrates a pipeline to transform a JSON file to a XML file using the Mustache Parser.
{
"flow":{
"name": "JSON to XML using Mustache",
"disabled": true
},
"listener": {
"type":"file",
"isMessageGenerator": true,
"path": "c:/test/in/json2xml.json",
"donePath": "c:/test/processing"
},
"route0":{
"type": "filereader",
"dependencies": "listener",
"donePath": "c:/test/done",
"encoding": "utf8"
},
"route1": {
"type": "mustache",
"dependencies": "route0",
"template": "c:/test/json2xml.xml"
},
"output": {
"type": "filewriter",
"dependencies": "route1",
"path": "c:/test/json2xml_out.xml",
"append": false,
"writeCloseTimeout": 5000,
"encoding": "utf8"
}
}
(C) 2018 - 2021 TekMonks