Handles top-level JSON Arrays from XML:choice with multiple occurs

When using the XML pattern complexType+choice you can define
an array of records, even though it would not be technically possible
in XML.

Example of an array of 3 records:

<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>
 <xs:element name='root'>
   <xs:complexType>
     <xs:choice maxOccurs='3'>
       <xs:element name='s' type='xs:string'/>
       <xs:element name='i' type='xs:int'/>
     </xs:choice>
   </xs:complexType>
 </xs:element>
</xs:schema>

Translates the XML
<root>
  
mystring

  <i>1</i>
  <i>2</i>
</root>

[{"s": “mystring”}, {"i": 1}, {"i": 2}]
Managing unbounded xs:choice elements as JSON arrays

Even when choice have unbounded maxOccurs, they still
need to be managed as JSON arrays
Encode optional value as Avro Union with “null” as first element

Optional values were correctly encoded as Avro Union type, but
unfortunately the “null” was placed on the second position, meaning
that the default value was actually required (and not optional).

The correct pattern to use Avro Union for optional values is described
in the Apache Avro documentation:

“Unions
Unions, as mentioned above, are represented using JSON arrays.
For example, ["null", "string"] declares a schema which may be either
a null or string.

(Note that when a default value is specified for a record field whose
type is a union, the type of the default value must match the first
element of the union. Thus, for unions containing "null", the "null"
is usually listed first, since the default value of such unions is
typically null.)”