rendering JSON with Grails?

后端 未结 2 1192
南笙
南笙 2021-01-24 16:50

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 tha

相关标签:
2条回答
  • 2021-01-24 17:05

    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

    0 讨论(0)
  • 2021-01-24 17:17

    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
    }
    
    0 讨论(0)
提交回复
热议问题