清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
import grails.converters.JSON class User{ String nickname Integer age } class TestController{ def listAsJson = { def output = "{'nickname':'东瓜','age':'16'}" render output as JSON } def listAsJSON2 = { def output = "{'nickname':'东瓜','age':'16'}" render JSON.parse(output) } def listAsJSON3 = { def user = User.get(1) render user as JSON } def listAsJSON4 = { def outputMap = ['1':1,'2':2] render outputMap as JSON } }