Grails Quickcasts, brought to you through a partnership between OCI and DZone, provide bite-sized tutorials to help you maximize your productivity with the Framework.
In a delightful and informative 15 minutes, Grails co-founder, Jeff Scott Brown, probes JSON views.
Beginning with a Grails 3.1.1 application created with a standard web profile, Jeff demonstrates how to add a few custom domain classes.
Jeff uses music examples, including Space Oddity by David Bowie (RIP) and Close to the Edge by Yes, to populate an artist class with associated albums annotated with grails.rest.Resource.
The goal is to publish a REST API under
/artists to manage instances of the
artist class and to support the JSON and XML formats. Sending a request to
/artists delivers a list of artists, all of whom have albums associated with them.
While the app is running in development mode, the JSON files can be altered, and the effects of those changes can be seen real-time in the application.
This Quickcast assumes basic knowledge of Grails, JSON, and REST APIs.