Consider a simple class as :-
class Person{
String name
String email
int age
String mobileNum
}
I want to selectively send ‘id’ & ’email’ attributes as JSON response.
When using:-
return theObject as JSON
the response has all attribute:value pair.
You can register your own JSON marshaller (at
BootStrap.groovy, for example), like: