I want to embed JSON in the DOM as outlined in the below question:
Best practice for embedding arbitrary JSON in the DOM?
However I can't figure out how to do this with Scalate/Scalatra. I have this in my scaml template:
-@ val fullStateJson: String
and I can render it via
%div= fullStateJson
but I can't figure out how to get this into a <script>
. When I do
%script(type="application/json" id="fullStateScript") =fullStateJson
It ends up escaped, like
{"45":{"id":45,"level":0},"98":{"id":98,"level":0}}