The goal is to move from the Scala model / ViewModel to raw JSON, which can be loaded into the view template to avoid requests for JSON data after the page loads.
And an example of what I was playing with but no luck:
@(todos: play.api.libs.json.JsValue) @import play.api.libs.json.Json <html> <head>...</head> <body>...</body> <script> var todos = JSON.parse(' @Json.stringify(todos) '); </script> </html>
Basically, he spills out a lot of quoted text into action:
[{"id":":"294858e2-c9eb-4f50-9eac-47b257573d83"}]
No luck with Google or PlayFramework docs, so I would really like the help.
source share