In the Graphical Data Mapping editor, you can use the Cast function to create a JSON object or a JSON array.
Comply with the following rules before you create a JSON object or a JSON array:
JSON object example
"FirstName":"John"
<xsd:element name="Name" type="xsd:string" nillable="true"></xsd:element>
JSON array example
[{"ID": "123","Country": "US"},
{"ID": "124","Country": "UK"},
{"ID": "125","Country": "Japan"}
]
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://www.ibm.com/iib/msl/json"
targetNamespace="http://www.ibm.com/iib/msl/json">
<xsd:complexType name="JSONArray_MyObjType">
<xsd:sequence>
<xsd:element name="Item" type="tns:MyObjType" maxOccurs="unbounded" minOccurs="0"></xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="MyObjType">
<xsd:sequence>
<xsd:element name="ID" type="xsd:string"></xsd:element>
<xsd:element name="Country" type="xsd:string"></xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
Create the schema model for a JSON object or a JSON array. For more information, see Ways to create message models.