Graphically modeling a multidimensional JSON array in a message map
In the Graphical Data Mapping editor, you can use the Add User-Defined function to create a multidimensional JSON array, also known as a nested JSON array.
Before you begin
Create a message map with the output domain set to JSON. For more information, see Graphically modeling a JSON message in a message map
About this task
If you have a JSON schema for your message data, you can use that as described in Creating or transforming a JSON message by using a JSON schema. Alternatively, you can model a multidimensional JSON array in your message map by following these steps:
Procedure
To create a multidimensional JSON array in a JSON object message, complete the following steps:
Example
{"MyArray":[ [1.1], [2.1, 2.2] ]}
- Add a user-defined element of type JSONArray_Default, and change its name to MyArray.
- Set the type of Item to JSONArray_Default.
- Set the type of the nested Item element to float.
(0x01000000:Object):JSON = ( ['json' : 0x2f033910]
(0x01000000:Object):Data = (
(0x01001000:Array):MyArray = (
(0x01001000:Array):Item = (
(0x03000000:NameValue):Item = 1.1E+0 (FLOAT)
)
(0x01001000:Array):Item = (
(0x03000000:NameValue):Item = 2.1E+0 (FLOAT)
(0x03000000:NameValue):Item = 2.2E+0 (FLOAT)
)
)
)
)
What to do next
Deploy the message map and verify that the output message is valid. For more information, see Troubleshooting a message map.