JSLT
Discover more about the JSLT connector and how to use it on the Digibee Integration Platform.
Last updated
Was this helpful?
Discover more about the JSLT connector and how to use it on the Digibee Integration Platform.
Last updated
Was this helpful?
Was this helpful?
The JSLT connector allows manipulation of a JSON using JSLT, a language for JSON processing and querying. For more information, see the official documentation on Github.
The connector is useful to perform several actions, such as:
Modify the structure of a JSON and keep its values.
Add, extract, and remove data from a JSON.
Sort the structure of a JSON.
Modify the values contained in a JSON through functions, such as text manipulation, mathematical calculations, conversions between data types, among others.
Access and manipulate data from arrays.
Take a look at the configuration parameters for the connector. Parameters supported by Double Braces expressions are marked with (DB)
.
Payload (DB)
The JSON content to be manipulated.
{{ message.payload }}
JSON
JSLT
The JSLT declaration to be executed.
{ *: . }
JSON
Fail On Error
If enabled, interrupts the pipeline execution when an error occurs. If disabled, execution continues, but the "success"
property will be set to false
.
False
Boolean
Raw Mode
If this option is active, the JSLT expression can dynamically incorporate values using Double Braces ({{ }}
) for entire expressions, object keys, or object values. This enables more flexible and dynamic transformations.
Important: When using Double Braces for a JSON key within the jsltExpr
and Raw Mode is enabled, you must escape the key. For example, to dynamically use myKey
as a key, you would write "{ \"{{message.myKey}}\": .value }"
.
False
Boolean
Documentation
Optional field to describe the connector configuration and any relevant business rules.
N/A
String
{
"id" : "w23q7ca1-8729-24923-922b-1c0517ddffjf1",
"type" : "component",
"prefix": "jslt",
"myString": "test",
"myArray": [ 1, 2, 3, 4],
"boolean": true
}
{
"uuid": .id,
"obj": {
"key-1": .type,
"key-2": .prefix
},
* - myString, myArray, id: .
}
{
"uuid" : "w23q7ca1-8729-24923-922b-1c0517ddffjf1",
"obj" : {
"key-1" : "component",
"key-2" : "jslt"
},
"type" : "component",
"prefix" : "jslt",
"boolean" : true
}
{
"id" : "w23q7ca1-8729-24923-922b-1c0517ddffjf1",
"type" : "component",
"prefix": "jslt",
"myString": "TEST",
"myArray": [ 1, 2, 3, 4],
"boolean": true
}
{
"uuid": split(.id, "-"),
"obj": {
"key-1": uppercase(.type),
"key-2": join(.myArray, lowercase(.myString))
},
* : .
}
{
"uuid" : [ "w23q7ca1", "8729", "24923", "922b", "1c0517ddffjf1" ],
"obj" : {
"key-1" : "COMPONENT",
"key-2" : "1test2test3test4"
},
"id" : "w23q7ca1-8729-24923-922b-1c0517ddffjf1",
"type" : "component",
"prefix" : "jslt",
"myString" : "TEST",
"myArray" : [ 1, 2, 3, 4 ],
"boolean" : true
}
{
"id" : "w23q7ca1-8729-24923-922b-1c0517ddffjf1",
"s1": "jslt",
"s2": "component"
}
let splitted = split(.id, "-")
let size = size($splitted)
def concat(s1, s2)
if ($s1 != null)
$s1 + "___" + $s2
else
""
{
"variables": $splitted,
"size": $size,
"customFunction": concat(.s1, .s2)
}
{
"variables": [
"w23q7ca1",
"8729",
"24923",
"922b",
"1c0517ddffjf1"
],
"size": 5,
"customFunction": "jslt___component"
}
{
"id" : "w23q7ca1-8729-24923-922b-1c0517ddffjf1",
"status": true
}
let aux = split(.id, "-")
def concat(string1, string2)
$string1 + "-" + $string2
{
"forResult": [for ($aux) concat("test", .)],
"ifResult": if (.status)
size(.id)
else
0
}
{
"forResult" : [ "test-w23q7ca1", "test-8729", "test-24923", "test-922b", "test-1c0517ddffjf1" ],
"ifResult" : 38
}
When Raw Mode is enabled, you can dynamically construct parts of your JSLT expression using Double Braces ({{ }}
).