grails - How to only send certain properties of a class as json -


i have simple action such this:

def showsomething() {    render color.get(params.id) json } 

this render properties in color class json. however, if want render 2 properties, say, colorname , shade?

gjordis has right option if want render same properties everytime render object. however, this:

color color = color.get(params.id) render ([colorname: color.colorname, shade: color.shade] json) 

Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -