JSON Adapter - Processing JavaScript object notation files
The JSON Adapter permits JSON files to be read and/or written from within FlowHeater.
JSON was originally designed for use with JavaScript. However, the JSON format has since established itself as a compact file format for simple data exchanges between various systems. When used in conjunction with the REST API adapter, complex logical constructs can be mapped without resorting to complicated programming. See the examples below.
General tab
JSON filename: Enter here the file name of the JSON file to be read or written. A path specification (absolute or relative) is optional. Any relative path originates from the folder that contains the FlowHeater Definition (the .FHD file).
Overwrite an existing file: This option is only available on the WRITE side (for export). If this option is checked, the file will be overwritten each time it is exported. When unchecked, the content is appended to an existing JSON file.
Fields / Data types tab
This tab allows you to define the JSON structure that is desired or retrieve such from an existing JSON file.
Refresh from file: This button will retrieve the structure from an existing JSON file.
JSON type: Select the JSON field type. The following values are available:
Value: The value is formatted based on the selected FlowHeater data type.
Object: The sub-nodes are defined as a JSON object enclosed in curly brackets “{}”.
Array: The sub-nodes are defined as a JSON object enclosed in square brackets “[]”.
Default value: This value is applied if no specific value is assigned to the field.
Note: The selected FlowHeater data type is taken into account when formatting the output.
Adapter settings in the Format tab
The following examples are available for the JSON Adapter