I am creating a test application that simply creates a JSON representation of an object and sends it to the template, I then want to use the JSON in a a JS script on the front end. I am using Ratpack and Java Handlebars to do this.
Here is my Ratpack handler
class HighChartHandler extends InjectionHandler {
void handle(Context ctx, TestDataJson testDataJson) {
testDataJson.goals = 1000
testDataJson.name = "Nick"
def jsonData = json(testDataJson)
ctx.render(handlebarsTemplate('highchartTest.html', model: jsonData))
}
}
And then I try to simply render the data on the page using
<h1>Graph Test</h1>
<p>This is a WIP highchart test</p>
<p>{{model}}</p>
However I get this message :
ratpack.jackson.internal.DefaultJsonRender@467db85c
I want to simply render something like
{"name":"Forlan","goals":1000}