I'm using Play framework and trying to send a Json string from the server as a parameter to a Scala template.
@(aj: String)
@import play.api.libs.json.Json
<!DOCTYPE html>
<html lang="en">
<body>
<div id="container">
@aj
</div>
<script>
var ab=@Json.toJson(aj);
var a = JSON.parse(ab);
</script>
</body>
</html>
I get the Json String displayed inside the container div. But I'm not able to get the Json out of 'aj' into a javascript variable. Please help.
In view you can do: