render 同样被用于输出JSON:def list = {
def results = Book.list()
render(contentType:"text/json") {
books {
for(b in results) {
book(title:b.title)
}
}
}
}
在这种情况下,结果大致相同:[
{title:"The Stand"},
{title:"The Shining"}
]
同样的命名冲突危险适用于JSON生成器.
render 同样被用于输出JSON:def list = {
def results = Book.list()
render(contentType:"text/json") {
books {
for(b in results) {
book(title:b.title)
}
}
}
}
在这种情况下,结果大致相同:[
{title:"The Stand"},
{title:"The Shining"}
]
同样的命名冲突危险适用于JSON生成器.