When converting XML to JSON, and using an Avro schema to specify what that JSON should look like, how does NiFi handle instances of a single XML child element versus multiple child elements when doing the conversion? For example:
Given the following XML:
<employees>
<employee>
<name>John Doe</name>
<addresses>
<work>
<number>123</number>
<street>5th Avenue</street>
<city>New York</city>
<state>NY</state>
<zip>10020></zip>
</work>
<home>
<number>456</number>
<street>Elm Street</street>
<city>Queens</city>
<state>NY</state>
<zip>10023></zip>
</home>
</addresses>
</employee>
<employee>
<name>Bob Smith</name>
<addresses>
<home>
<number>987</number>
<street>Oak Road</street>
<city>Staten Island</city>
<state>NY</state>
<zip>10030></zip>
</home>
</addresses>
</employee>
</employees>
The first employee, John Doe, has two address which NiFi converts to a JSON array, good to go. However, the second employee, Bob Smith, works from home so he has only one address. However, the "address" field is an array so Bob Smith's addresses needs to be a one element array. By using an avro schema during the write operation the, the ConvertRecord processor throws an error when it encounters a record like Bob Smith rather than creating it as a single value array. How do I configure NiFi to use the schema to define the JSON output so I can ensure Bob Smith's addresses are captured as single value arrays?
Thanks for the support!