I'm using Grails 3 and org.grails.plugins:views-json:1.0.0
. Is it possible to render command object as a json result? Is it rendering only domain classes provided in a model?
I tried:
model {
TrainingStatisticsCommand cmd
}
json.cmd {
startDate cmd?.startDate
endDate cmd?.endDate
trainings tmpl.training(cmd?.trainings)
}
but I received:
{
"cmd": {
"startDate": null,
"endDate": null,
"trainings": null
}
}
I'm executing it from controller as:
respond cmd, [status: OK, view:"trainingsByClients"]
and cmd
object has inside some data for sure.
You model would need to be
Or you would need to be explicit about the model variable name.