I'm looking for a template engine that meets a specific criteria:
This:
template.render("This is a json object: {{jsonObject}}", {jsonObject : {property: "string"}})
would output this:
"This is a json object: {jsonObject : {property: "string"}}"
And not this:
"This is a json object: [Object object]"
However, I should still be able to do this:
template.render("This is a property: {{jsonObject.property}}", {jsonObject : {property: "string"}})
And get this:
"This is a property: string"
It works with express.js
It uses normal HTML. Nothing like haml/jade.
It can render unescaped values, the less boilerplate the better.
The reason: I'm working on a project where I want someone to be able to create an html document that uses a passed in JSON object inside of its script tags. There are simpler ways to achieve that goal I realize, for example the object could be stringified, but I think being able to manipulate that object with a templating engine as well would have some benefits.
try https://github.com/visionmedia/ejs it is rendering engine that works both client and server side
There is "JSON Template" but I'm not sure about "as express engine" I would definitely propose to (use) swig - http://paularmstrong.github.io/swig/
the author explained it here - it's pretty simple ;): access json data using swig-template