I use this code to build an array of employees:
render(((new JsonBuilder())
{
'all' employees.collect { Employee employee ->
[
id: employee.id,
name: employee.firstName + " " + employee.lastName
]
}.sort() { it.name }
}) as JSON)
the result is:
"{
all: [
{id: 1, name: "balh blah"},
...
]
}"
but I want a json of an array without the "all" field, like this:
"[
{id: 1, name: "balh blah"},
...
]"
How can I achieve that?
Thanks for help!