If json is starting with array, JsonExtract is not reading any data.
Json starting with array :
[
{
"id": "1",
"name": "emp1",
"addresses": [
{
"area": "area1",
"city": "city1",
"state": "state1",
"pin": "pinxyz"
}
],
"phoneNumbers" : [
{
"type":"home",
"number": "212 555-1234"
},
{
"type": "fax",
"number": "646 555-4567"
}
]
}
]
and extraction mapping is :
<mappings>
<Mapping cloverFields="id;name" element="json_object" outPort="0" sequenceField="json_object_seq" sequenceId="InternalSequence" xmlFields="{}id;{}name">
<Mapping cloverFields="area;city;state;pin" element="addresses" generatedKey="parentId_json_object" outPort="1" parentKey="json_object_seq" sequenceField="addresses_seq" sequenceId="InternalSequence" xmlFields="{}area;{}city;{}state;{}pin"/>
<Mapping cloverFields="type;number" element="phoneNumbers" generatedKey="parentId_json_object" outPort="2" parentKey="json_object_seq" sequenceField="phoneNumbers_seq" sequenceId="InternalSequence" xmlFields="{}type;{}number"/>
</Mapping>
</mappings>
Records emitted from JsonExtract are 0 from all output ports. Where as if json comes as object without array, it is working as expected.
Child element arrays are working good, problem with root level array.
Json without array :
{
"id": "1",
"name": "emp1",
"addresses": [
{
"area": "area1",
"city": "city1",
"state": "state1",
"pin": "pinxyz"
}
],
"phoneNumbers" : [
{
"type":"home",
"number": "212 555-1234"
},
{
"type": "fax",
"number": "646 555-4567"
}
]
}
Expecting this to be handled by JsonExtract. Please suggest how to handle above scenario.