ExtendedJsonCreationUnit
Group |
|
Function |
This Integration Unit creates a JSON file from the target tree. |
Description
Introduction: Integration Units. Set the Content in the Content settings of a Response Route in phase 6 to Output of IU.
This Integration Unit creates a JSON file from the target tree. We assume the knowledge about the structure of JSON files as a given.
The encoding of the file is always UTF-8.
The following shows how the structure of the profile's target tree, together with the Integration Unit, determines the structure of the generated JSON file.
Parameter Description
Parameter name |
Allowed values |
Default value |
Description |
Add JSON data at end |
<Text> |
|
Inserts text at the end of the generated JSON document (after the cutting). |
Chars to cut off at the beginning |
<Integer value> |
0 |
Number of characters to be cut off at the beginning of the created JSON file. Note: If the JSON lines format is generated, the cutting is done per line. Note: The parameter is used to correct an invalid JSON file in order to obtain a valid one. |
Chars to cut off at the end |
<Integer value> |
0 |
Number of characters to be cut off at the end of the created JSON file. Note: If the JSON lines format is generated, the cutting is done per line. Note: The parameter is used to correct an invalid JSON file in order to obtain a valid one. |
Enable '_name' field handling |
true, false |
false |
See parameter Use description as field/node name. |
Escape < and > |
true, false |
false |
The characters < and > are escaped by this Integration Unit. The result is < und > This option should be set to true if the Integration Unit is used for Forms. This can prevent JavaScript injection. |
Insert JSON data at beginning |
<Text> |
|
Inserts text at the beginning of the generated JSON document (after the cutting). |
Pretty print |
true, false |
true |
If true, the JSON file is formatted. Note: If you set this parameter to true , please do not use the parameters Chars to cut off at the beginning and Chars to cut off at the end , as this can lead to errors in the generated file. |
Resolve OData names |
true, false |
false |
A name like @company.com would be allowed in JSON but is escaped in this Integration Unit. The result would be __at__company__dot__com If you do not want those characters to be escaped, set the option to true. |
Start at node |
<Node name> |
|
If a node name is set, the creation of the JSON file starts with this node. If no value is specified or the value root, the (invisible) top-level node is used as the transparent node. |
Use description as field/node name |
true, false |
false |
If true, the value of attribute Description is used as node/field name. Note: If you want to rename a node during runtime, you can use a field with suffix _name to rename its parent node. The name of the JSON object is no longer determined by the name of the parent node but the value of the field (not name). The field name needs a prefix that is equal to the name of the parent node that shall be renamed. So if you want to rename parent node POS, you have to use field name POS_name. Important note: Parameter Enable '_name' field handling must have the value true for this. Note: You cannot use this method to rename the top level node (root node). Note: If a node is used to create an array (see node MyArray in the examples below), the field value of MyArray_name of the last iteration is used. |
Write as JSON Lines Format |
true, false |
false |
If true, the file is created in the JSON Lines format. See section Creating JSON Lines Format below. |
Write empty '_val' arrays |
true, false |
false |
When creating arrays with a node and _val field (see below), empty arrays are written if the parameter is set to true. If false, then not. |
Write empty fields not as null |
true, false |
false |
If true and parameter Write empty/null field values is also true, value "" will be used instead of value null. |
Write empty/null field values |
true, false |
false |
If true, fields with set Empty Flag will be included in the JSON document with value null. See also parameter Write empty fields not as null. |
Write nodes without children |
true, false |
false |
If true, nodes without fields, or if the fields have no values, are also output. |
Write top level node as anonymous element |
true, false |
false |
If true, the top-level node creates an anonymous element in the JSON file (i.e. without a name) . See sections Records and Creating Anonymous Top-level Element below . Important note: Parameter Start at node must be filled and parameter Write as JSON Lines Format must not have the value true. |
Write values type safe |
true, false |
true |
If true, fields of type Integer, Float, Double, BigInteger, BigDecimal and Boolean will not be written in quotes. Important note: This setting has no effect if a template is used. |
Records
For one record, the structure {target tree} is created if the top level node creates an object.
For one record, the structure [target tree] is created if the top level node creates an array.
For multiple records, the structure [{target tree record 1},{target tree record 2}, ...] is created if the top level node creates an object.
For multiple records, the structure [target tree record 1, target tree record 2, ...] is created if the top level node creates an array.
Which JSON structure is created for the target tree is described in the sections below.
Note: See also section Creating Anonymous Top-level Element below.