JavaScript Object Notation (JSON) parser
You can use JavaScript Object Notation (JSON) parsing with IBM Sterling Transformation Extender Design Studio to accept a JSON document as a type tree.
Design Studio accepts a JSON document as type tree input, and creates an MTX file from the JSON document that shows all the fields in the structure that is contained in the JSON document. Depending on the data in the JSON document, two field types are supported (text and numeric). Boolean field types are displayed as text field types with true or false as the data. Any field that contains a null value is considered a text field.
Additionally, JSON documents include two JSON group types, JSON arrays and JSON objects. The default attribute for both group types is unordered (which is the default), but you can also select a sequenced attribute. Choosing the sequenced attribute causes IBM Sterling Transformation Extender to process the document in sequence order, which ameliorates any confusion that can occur with unordered processing. To change an attribute from unordered to sequenced, select the Set Default Group Class as sequenced option on the Native JSON Customization page and click Finish.
You can also add an AnyType group field to any level of the JSON document. The anytype group field contains two fields, a name fields and a data text field, which allows the JSON tree to handle data that was not in the original document. When you use the AnyType field, any type of data is mapped to the field. To add AnyType group fields to the JSON document, select the Add AnyType fields to every level option on the Native JSON Customization page and click Finish.
Guidelines for the JSON prototype object schema file
You must follow these guidelines when you create the JSON prototype object schema file:
- The JSON file that you use for IBM Sterling Transformation Extender native JSON processing must be a prototype object that best represents the data you plan to use.
- Ensure that all fields are defined in the JSON file.
- When you use arrays, ensure that all fields that to be used in that array are defined in the first iteration of that array.
- When you use native JSON to define the main input or output
card, always select the main Type as the first
JSON type. Note: The main input or output card is the card that has the file or other source that defines how to parse or create the document.
- The encoding field on input always returns the value NONE. On output, this field can be set to any valid JSON encoding and the JSON document is produced that uses that encoding. If you do not configure the encoding, the default encoding used is UTF-8.