This issue is not related to ordering. The values of duplicate tags at the same level in XML are being combined into an array, where if there's only one tag it's converted to an object. This is a common way JSON libraries handle duplicate field names in an object.
While the official JSON standard does not forbid duplicate keys, it is discouraged and there is no requirement for them to be supported.
This Stack Overflow answer explains and gives sources for this very clearly: