Grails: JSONP callback without id and class in JSON file
        Posted  
        
            by Klaas
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Klaas
        
        
        
        Published on 2009-11-09T12:20:38Z
        Indexed on 
            2010/06/13
            5:02 UTC
        
        
        Read the original article
        Hit count: 410
        
Hi,
I am working on a REST based interface where people get a json file. The client needs to access the file from another Domain. I use jsonp which works so far. My problem is the rendering in Grails. At the moment I use the 'as JSON' to marshalling the object:
render "${params.jsoncallback}(${user as JSON})"
The Json file getting to the client inclused all attributes, incluing the id and class, which I do not want to have in there. In case it is not jsonp, I do it this way, which works great:
render(contentType:'text/json'){
   userName  user.userName
   userImage user.userImage
    :
    :
}
So how do I get the id and class attributes out of the json when rendering "user as JSON"? Any idea?
best regards, Klaas
© Stack Overflow or respective owner