Importing/Creating JSON definitions
When creating a JSON structure without using the JSON Schema import, it is important that this sample document have all of the possible objects and non-object values that can occur in any JSON instance documents. If this is not the case, then it's possible to get runtime errors when processing the JSON instance documents since required elements will not be present in the structure.
It is possible to manually create a JSON structure or manually modify the imported JSON structure to add the missing elements, so long as you follow the conventions in this section.
Numeric Types
JSON does not specify a mechanism to determine the scope of numbers, so these have to be derived by looking at the actual values when importing the JSON. The importer will use either the Decimal or Double data type when encountering a number, depending on the presence or absence of the e (exponent) value. Decimal is assumed rather than integer because the size of the number could be larger than an Integer (or even 64-bit Long). In addition, the number could actually have a fractional component in the actual data. Decimal will thus always work in these situations. Double is assumed for floating point numbers (having the exponent value).
Arrays
-
All same typed non-objects - Every member of the array is a non-object (decimal, double, string or boolean) and they are all the same type (not decimals mixed with doubles for example). In this case, the element of the array will loop, have the data type corresponding to the detected non-object type, and will not be a container.
-
All objects - Every member of the array is an object. This is handled like any other object nesting.
-
Mixture of objects and non-objects - The "mixed" case where some members of the array are objects and others are non-objects. Alternatively all members could be non-objects, but their types are not the same (a mix of decimal numbers and strings for example).
This is not treated as a loop, but rather a specific collection of the objects and non-objects as specified in the array and a separate element is created for each. The usual member element is created for each object. For the non-objects, an anonymous member with the name _anonDecimal (replacing Decimal with String, Double, or Boolean) is created for each type of non-object that is present. Each element name in this "mixed" array will be suffixed with the position of the element in the array.
Information noteNote: For the JSON SAX Reader and Writer to be able to read a mixed JSON array, use the choice type.
Dates
JSON does not provide a means to specify that a non-object value is a date type. However you can do this simply by changing the data type to Date, Date/Time, or Time in the structure editor for the element that contains the date. You can also select the applicable data format if it's not the standard ISO 8601 date format. If you do this, then the dates will be properly recognized so they can be automatically converted when being mapped.