Renders a template using a JSON object as variables.
Top-level string values in the JSON object are extracted as template variables. Array values are joined with commas for use with the #each directive.
Example:
var json = Json.parse ("{\"name\": \"World\"}");
string tpl = "Hi " + "{{na" + "me}}!";
string result = Template.renderJson (tpl, json);
// result == "Hi World!"
| template |
template string. |
| vars |
JSON object containing variables. |
|
rendered string. |