I want to serialize JSON. Consider the following function:
declare function local:index() { array{ $levinsohn/levinsohn/feature/header ! map {./name : ./description ! string() } } };
When I run that, I get output that looks like this:
[map { "Ambiguous": "Marked but ambiguous constituent order." }, map { "annotations": "Inline annotations." } !!! SNIP !!!]
That won't work as output in a REST API, so I want to serialize that without the map keyword. I tried to use fn:serialize():
declare function local:index() { array{ $levinsohn/levinsohn/feature/header ! map {./name : ./description ! string() } } ! serialize(.) };
That gave me this error:
items of type map(*) cannot be serialized
So ... what's the right way to do this?
Jonathan