Hello,
I'm trying to construct a query that will return the title and ID from a set of records, but instead of XML results I'd prefer JSON. I'd like the results to be in the following format:
[ ['id': 'value1', 'title': 'Title1'], ['id': 'value2', 'title': 'Title2'], ['id': 'value3', 'title': 'Title3'] ]
I understand I'd need to use the JSON module, but I'm having trouble getting the results into the right format. This is what I have so far:
XQUERY for $poem in collection("lk") let $id := fn:string($poem/poem/@uuid) let $title := $poem/poem/title/text() order by $title return (<id>{$id}</id>, <title>{$title}</title>)
This returns the XML, but does anyone know how to convert into the desired JSON format?
Many thanks