Open akirattii opened 3 years ago
Not really a bug, but can be improved. Contributions are welcome in this direction.
You should just use the <div><%- JSON.stringify(obj) %></div>
instead of <div><%= JSON.stringify(obj) %></div>
and you will get your json
I recently started using ajs the greate alternative of ejs to improve blocking behavior of it. Well, I found that ajs seems not to escape
<%= JSON.stringify(obj) %>
in template.Premise:
ajs example
server.js
views/index.ajs
output:
Oops, JSON output is not escaped!?
ejs example
In the case of
ejs
, it outputs escaped JSON looks like this:output: (JSON output escaped)
views/index.ejs (contents is same as index.ajs)
server.js (using ejs)
Is it a bug? Thank you in advance.