Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "BaSyx / Documentation / Components / DataBridge / Features / Data Transformation / JSONata"
(Created page with "= JSONata= The JSONata transformer can be integrated with DataBridge. The Jsonata component allows you to process JSON messages using the [https://jsonata.org/ JSONATA] specif...") |
m (→Working Example) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
= JSONata= | = JSONata= | ||
− | The JSONata transformer can be integrated with DataBridge. The Jsonata component allows you to process JSON messages using the [https://jsonata.org/ | + | The JSONata transformer can be integrated with DataBridge. The Jsonata component allows you to process JSON messages using the [https://jsonata.org/ JSONata] specification. This can be ideal when doing JSON to JSON transformation and other transformations from JSON. |
== Configuration == | == Configuration == | ||
Line 18: | Line 18: | ||
<span style=color:red>Disclaimer: Please use only the relative path (queryPath) of the file containing JSONata expressions. </span> | <span style=color:red>Disclaimer: Please use only the relative path (queryPath) of the file containing JSONata expressions. </span> | ||
+ | |||
+ | Below is an example expression that can be put in the '''jsonataA.jsonata''' file. | ||
+ | |||
+ | === Sample JSONata expression === | ||
+ | <pre class="mw-code"> | ||
+ | $sum(Account.Order.Product.(Price * Quantity)) | ||
+ | </pre> | ||
+ | |||
+ | To learn more about JSONata expressions please refer [https://jsonata.org/ JSONata Org] | ||
Similarly, you can configure multiple JSONata transformers inside the configuration file. | Similarly, you can configure multiple JSONata transformers inside the configuration file. | ||
Line 25: | Line 34: | ||
== Working Example == | == Working Example == | ||
− | The integration example with MQTT as a data source, '''JSONata''' as a transformer, and AAS as a data sink is available on [https://github.com/eclipse-basyx/basyx-databridge/tree/main/ | + | The integration example with MQTT as a data source, '''JSONata''' as a transformer, and AAS as a data sink is available on [https://github.com/eclipse-basyx/basyx-databridge/tree/main/databridge.examples/databridge.examples.mqtt-jsonata-aas GitHub DataBridge Example]. |
Latest revision as of 03:17, 10 May 2023
Contents
JSONata
The JSONata transformer can be integrated with DataBridge. The Jsonata component allows you to process JSON messages using the JSONata specification. This can be ideal when doing JSON to JSON transformation and other transformations from JSON.
Configuration
To configure JSONata transformer in DataBridge you need to provide the unique id, the relative path to the file containing JSONata expressions, input type and the output type.
Sample Configuration
[ { "uniqueId": "jsonataA", "queryPath": "jsonataA.jsonata", "inputType": "JsonString", "outputType": "JsonString" } ]
Disclaimer: Please use only the relative path (queryPath) of the file containing JSONata expressions.
Below is an example expression that can be put in the jsonataA.jsonata file.
Sample JSONata expression
$sum(Account.Order.Product.(Price * Quantity))
To learn more about JSONata expressions please refer JSONata Org
Similarly, you can configure multiple JSONata transformers inside the configuration file.
Naming Convention
The name of the JSONata configuration file should be jsonatatransformer.json.
Working Example
The integration example with MQTT as a data source, JSONata as a transformer, and AAS as a data sink is available on GitHub DataBridge Example.