Marshaller in Grails

static {
        JSON.registerObjectMarshaller(this){
            Map<String,DomainName> objDomain = new LinkedHashMap<>(it.properties)
            objDomain.id = it.id
            objDomain.objectOtherDomain = OtherDomainName.get(it.otherDomainId)
            return objDomain
        }
    }
Silly Sandpiper