Homogenous Multidimensional Array Support in JSON Documents
You can select a JSON sample with homogenous multidimensional arrays when configuring the REST Adapter in the Adapter Endpoint Configuration Wizard.
All JSON messages must be converted to XML before they can be processed by Oracle Integration at runtime. Semantically, there is no equivalent of multidimensional arrays in XML. To support multidimensional arrays, intermediate XML elements are generated that denote the beginning and ending of a nested array. When receiving a JSON message containing multidimensional arrays, these reserved elements are injected into the generated XML to denote the beginning and ending of a nested array. While converting XML elements back into JSON, the injected elements are converted into JSON with nested arrays.
The following JSON document consists of a multidimensional array
(@ref "rercordsDataā
).
{
"studentData": {
"fieldNames": [ "id","mobile_number" ],
"recordsData": [ ["21","23"], ["+91123456789", "+91987654321" ] ],
"name": "jack"
},
"schoolData": {
"Name": "ABCInternations",
"StudentNumbers": 1300,
"Address": "YYY streets Sector-44 India"
}
}
The sample generated schema XML for the JSON document looks as follows:
<?xml version = '1.0' encoding = 'UTF-8'?>
<ns0:executeResponse xmlns:ns1="http://xmlns.oracle.com/cloud//REST/test/types"
xmlns:ns0="http://xmlns.oracle.com/cloud//REST/test_REQUEST/types">
<ns1:response-wrapper>
<ns1:studentData>
<ns1:fieldNames>id</ns1:fieldNames>
<ns1:fieldNames>mobile_number</ns1:fieldNames>
<ns1:recordsData>
<ns1:nestedArray>
<ns1:nestedArrayItem>21</ns1:nestedArrayItem>
<ns1:nestedArrayItem>23</ns1:nestedArrayItem>
</ns1:nestedArray>
<ns1:nestedArray>
<ns1:nestedArrayItem>+91123456789</ns1:nestedArrayItem>
<ns1:nestedArrayItem>+91987654321</ns1:nestedArrayItem>
</ns1:nestedArray>
</ns1:recordsData>
<ns1:name>jack</ns1:name>
</ns1:studentData>
<ns1:schoolData>
<ns1:Name>ABCInternations</ns1:Name>
<ns1:StudentNumbers>1300</ns1:StudentNumbers>
<ns1:Address>YYY streets Sector-44 India</ns1:Address>
</ns1:schoolData>
</ns1:response-wrapper>
</ns0:executeResponse>
Elements in the nested array appear as nestedArray
in
the mapper and items in the elements appear as nestedArrayItem
. You
must map nestedArray
as a for-each
statement and
nestedArrayItem
as a for-each
statement.
Description of the illustration ics_md_jsonl.png