Is there a way to remove the class field in a JSON converter?
Example:
import testproject.*
import grails.converters.*
emp = new Employee()
emp
import testproject.*
import grails.converters.*
import grails.web.JSONBuilder
def emp = new Employee()
emp.lastName = "Bar"
def excludedProperties = ['class', 'metaClass']
def builder = new JSONBuilder.build {
emp.properties.each {propName, propValue ->
if (!(propName in excludedProperties)) {
setProperty(propName, propValue)
}
}
render(contentType: 'text/json', text: builder.toString())