【发布时间】:2014-06-17 10:15:49
【问题描述】:
如果 request.json 中有一条记录,则以下代码有效
class BookController {
def save = {
def book = new Book(JSON.parse(yourJson))
book.save(flush:true)
}
}
但是如果我的 request.JSON 中有多个记录,如何获取 bookList,例如:
[{
"id": 3,
"name": "MYNAME",
"description": "test",
"category": 1,
"venue": null,
"status": "Published",
"deleted": false,
"pricingPolicy": null
}, {
"id": 6,
"name": "YZ",
"description": "test6",
"category": 2,
"venue": null,
"status": "Unpublished",
"deleted": false,
"pricingPolicy": null
}, {
"id": 9,
"name": "YZ",
"description": "test6",
"category": 1,
"venue": null,
"status": "Published",
"deleted": false,
"pricingPolicy": null
}]
【问题讨论】:
标签: grails grails-orm grails-2.0