Given: myList = [request:request,actions:actions] where request is an object and actions is a map.
Trying to get something like this:
{data:[
{a:'a',b:'b',actions:[c:'c',d:'d']},..
]}
where a and b are request properties while c and d are actions are map entries.
using:
render(contentType:"text/json"){
data = array {
myList.each { obj->
rqst = {
obj.request
actions = {actions: obj.actions}
}
}
}
}
obviously syntax here is wrong… but perhaps close?
I think the following accomplishes what you were looking for. PropsHolder is a simple inner class with two (a, b) properties
The json result looks like this when output to a web page:
I wasn’t quite sure with the [a, b, actions] collection if you were looking for a map or an array. Tough to tell from the output, I went with map.