|
1 |
| -# Cortex-convert-to-JSON |
| 1 | +[](https://www.cortex-ia.com/our-software) |
| 2 | +[](https://www.linkedin.com/company/cortex-intelligent-automation-software/) |
| 3 | +[](https://www.cortex-ia.com/latest-news-at-cortex/) |
| 4 | + |
| 5 | +# Cortex-Convert-to-JSON |
2 | 6 | This provides a subtask to convert a Cortex structure to JSON, according to a provided mapping specification
|
| 7 | + |
| 8 | +This subtask accepts the following parameters: |
| 9 | +Input parameter Name | Description | Type | M/O | |
| 10 | +-----------|-------------|------|-----| |
| 11 | +**i_JSON**|Any existing JSON to which the converted strcuture will be appended|Text|O |
| 12 | +**i_object-to-convert**|The Cortex object which is to be converted to JSON|Any|M |
| 13 | +**i_object-specification**|The specification of the mapping to JSON for the object being converted|Structure|M |
| 14 | +**i_type**|The type of the object being converted, must be one of *TEXT*, *NUMBER*, *BOOLEAN*, *OBJECT* (for Cortex Structures), *ARRAY* (for Cortex Lists)|Text|O - defaults to *TEXT*) |
| 15 | +**i_indent**|Any existing indent which is added to the start of each line|Text|O |
| 16 | +**i_indent-size**|The nuber of spaces to increase the indent by on sub-objects|Integer|O (defaults to 4) |
| 17 | +**i_included-fields**|A specification of fields to include in the JSON output; only used if **i_object-type** is *OBJECT*|Structure|O (if not provided, all fields are included) |
| 18 | + |
| 19 | +The subtask returns the following parameters: |
| 20 | +Output parameter Name | Description | Type | |
| 21 | +-----------|-------------|------| |
| 22 | +**o_JSON**|The JSON representing the structure|Text |
| 23 | + |
| 24 | +### Object Specifications |
| 25 | + |
| 26 | +#### If **i_object_type** is *OBJECT* |
| 27 | +The **i_object-specification** parameter is a Structure with the same fields as are present in the **i_object-to-convert** Structure. The value of each field in the **i_object-specification** Structure is a Structure with the following fields: |
| 28 | +1. JSON-object-name - the value to be used in the JSON for the name of the field |
| 29 | +2. JSON-object-type - the type of this field; can take values *TEXT*, *NUMBER*, *BOOLEAN*, *OBJECT* or *ARRAY* |
| 30 | +3. specification - for fields of type *OBJECT* or *ARRAY*, the specification of the value of the field |
| 31 | +4. JSON-included-fields - for fields of type *OBJECT*, the sub-fields to include in the output |
| 32 | +#### If **i_object-type** is *ARRAY* |
| 33 | +The **i_object-specification** parameter is a Strcture with the following fields: |
| 34 | +1. JSON-object-type - the type of every element in the List; can take values *TEXT*, *NUMBER*, *BOOLEAN*, *OBJECT* or *ARRAY* |
| 35 | +2. specification - the specification of the value of every element in the List |
| 36 | +3. JSON-included-fields - for fields of type *OBJECT*, the sub-fields to include in the output |
| 37 | + |
| 38 | +# Installation Instructions |
| 39 | +Download the Studio Package file and Import it into your Cortex Environment. |
| 40 | +Don't forget to apply rights using the Studio Authorization module. |
| 41 | + |
| 42 | +:thumbsup: Enjoy! :wink: |
0 commit comments