When converting a flat array from xml, when combined with other elements, the resulting JSON is invalid. for example,
when converting a piece of xml that looks like this:
<f>1</f>
<f>2</f>
<f>3</f>
, the result is correct : "f" : [1,2,3], however, if we add another node:<f>1</f>
<f>2</f>
<f>3</f>
<z>foo</z>, the result is something like this: { "f": "1", "f": "2", "f": "3", "z":"foo" }. I believe this is happening because of the array_? definition is checking distinct = 1 for fields of surrounding element.
a possible solution would be to first group by the name of the node and then do the array check for each group where an array is the map's value where count > 1. that would not drop elements and produce "correct" JSON.Thanks.