Created 03-25-2018 06:02 AM
Hi There,
I wish to apply a simple transformaton to a JSON using JOLT. I want to apply :substring(1,2) to the value of the key. I am using default jolt transformation but I don't know how to access the value of JSON from within JOLT and then apply the transformation?
Please help.
JOLT :
[{
"operation": "default",
"spec": {
"c":"${b:substring(1,2)}"
}
}] JSON :
{
"b":"hello"
}
Result :
{
"c":"",
"b":"hello"
}Expected result :
{
"c":"e",
"b":"hello"
}
Created on 03-25-2018 06:23 AM - edited 08-17-2019 11:18 PM
Extract the b attribute value before using it in Jolt transform by using EvaluateJson path processor and keep destination as flowfile-attibute.Then add your b attribute as a new property in evaluatejson path processor once we add b attribute to the flowfile then your jolt transform will apply substring function on the b attribute.
EvaluateJsonPath configs:-
Example:-
for testing i have added b attribute value as default in my jolt transform
Jolt spec testing:-
As you can see at right below corner we are having output json content with c key having e as value.
Let us know if you are having issues/questions..!!
Created on 03-25-2018 06:23 AM - edited 08-17-2019 11:18 PM
Extract the b attribute value before using it in Jolt transform by using EvaluateJson path processor and keep destination as flowfile-attibute.Then add your b attribute as a new property in evaluatejson path processor once we add b attribute to the flowfile then your jolt transform will apply substring function on the b attribute.
EvaluateJsonPath configs:-
Example:-
for testing i have added b attribute value as default in my jolt transform
Jolt spec testing:-
As you can see at right below corner we are having output json content with c key having e as value.
Let us know if you are having issues/questions..!!