Conversions
Use the tab 'Conversions' to configure Conversion scripts. A Conversion is a script that can be written in JavaScript that takes an INPUT value, performs processing, and assigns a value to the OUTPUT variable. Conversions are primarily used in Linked Data Resources to convert or process data from an external source.
The primary variables INPUT and OUTPUT can contain any plain value (i.e. string, number, boolean, null), array, or object.
When OUTPUT is an array or object it will also be possible to assign each key/property as a separate OUTPUT variable. This enables one Conversion to output to multiple Linked Data Resource response values simultaneously.
The script is run client-side in a separate worker/thread with subsequent calls for every new INPUT value.
To add a Conversion, click 'Add Conversion'.
To edit an existing Conversion, click the blue 'edit' button at the relevant Conversion.
To delete an existing Conversion, click the red 'del' button at the relevant Conversion.
Add / Edit a Conversion
Name | Specify the name of the Conversion. This name is used to identify the Conversion. |
Description | Enter a short description of the Conversion for your own reference. |
INPUT = | Provide a placeholder value to test the Conversion script. The value can be a string, number, boolean, null, or a JSON representation of an array, or object. The value does not need variable value quotes. The value should correspond with the type of output of the prospective Resource Paths. |
Script | Enter JavaScript that takes an INPUT value and assigns a value to the OUTPUT variable. Click the green 'test' button to run the Script and generate an OUTPUT value. |
OUTPUT = | This field has to contain a representation for the structure of the OUTPUT of the script. The representation is auto-generated when the Conversion in saved and contains one of the following: "" for a plain value, [] for an iterable array/object, or an object with properties that each can contain plain or iterable array/object values, e.g. {"output1": "", "a_multi_output": "[]"} . |