user471011
user471011

Reputation: 7386

rendering JSON with Grails?

I tried to find a cool guide how rendering JSON with Grails works, the documentation on official website - to me - very little information.

which articles you used that to understand how it works?

Thanks.

Upvotes: 1

Views: 844

Answers (2)

Bozho
Bozho

Reputation: 597362

I think this documentation is sufficient. You install the converters plugin and then render the response object as json:

def list = {
    def listResult = [ total: Book.count(), items: Book.list(params)]
    render listResult as JSON
}

Upvotes: 2

Gregg
Gregg

Reputation: 35904

It depends on what you mean by understanding how it works. If you really want to understand the how, the best thing to do is get the source code from Grails and step through it. If you just need to understand how to use it, the documentation is more than adequate. What exactly are you having problems with?

Documentation: http://grails.org/doc/latest/guide/6.%20The%20Web%20Layer.html#6.1.7 XML and JSON Responses

Upvotes: 0

Related Questions