Let’s say I have a class called Store that has many Employees. My RESTful listXML method looks like this:
def listXML = { render Store.list() as XML }
And the result looks like this:
<stores> <store id='1'> <name>My Store</name> <employees> <employee id='1' /> </employees> </store> </store>
My question is, how do I include all the data of each Employee class, so that my XML looks something like this?
<stores> <store id='1'> <name>My Store</name> <employees> <employee id='1'> <name>John Smith</name> <hireDate>2008-01-01</hireDate> </employee> </employees> </store> </store>
In your controller, you’ll want to import the deep converter:
You can read about it in the first couple of paragraphs of the Converters Reference.