Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Fat grails domain class with custom marshaller
import grails.converters.JSON
import org.joda.time.DateTime
class Media implements Serializable {
String url
String name
DateTime dateCreated
DateTime lastUpdated
static constraints = {
url blank: false, url: true, maxSize: 500
name nullable: true, mazSize: 100
dateCreated display: false, nullable: true
lastUpdated display: false, nullable: true
//here custom marshaller
static marshaller = {
JSON.registerObjectMarshaller(Media, 1) { m ->
return [
url: m.url,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.