How to force an JSON object to display as an array

If pub.json:documentToJSONString gets a document with a list as element it generates an array, even if there is ony one element in it. Your problem probably is in the transformation to the document from the xml. Please have a look into the generated document using debugger, I assume you won’t have a list there if only one element is present. The fields arrays and makeArrays of pub.xml:xmlNodeToDocument allow for explicit control where to generate arrays.