class Book {
    String title
}10.9.4 Rendering Domain Classes with JSON Views
Version: 3.3.2
10.9.4 Rendering Domain Classes with JSON Views
Typically your model may involve one or many domain instances. JSON views provide a render method for rendering these.
For example given the following domain class:
And the following template:
model {
    Book book
}
json g.render(book)The resulting output is:
{id:1, title:"The Stand"}You can customize the rendering by including or excluding properties:
json g.render(book, [includes:['title']])Or by providing a closure to add additional JSON output:
json g.render(book) {
    pages 1000
}