I'm new to Jolt transformations. I will try to describe my case in detail. I suspect that you will need to combine shift and modify-default operations
HERE: TRANSFORMATION RULE:
if field detail have value (exist and is not"" or null)
then map detail => updating_field
else:
map updating_field => updating_field
INPUT
{
"updating_field": "ACCEPT",
"channel": {
"detail": null
}
}
EXPECTED OUTPUT for e.g. detail = null value inside JOLT
{
"channel": {
"updating_field": "ACCEPT"
}
}
OTHER INPUT
{
"updating_field": "ACCEPT",
"channel": {
"detail": "normal_value"
}
}
OTHER EXPECTED OUTPUT for e.g. **detail = "normal_value" value inside JOLT
{
"channel": {
"updating_field": "normal_value"
}
}
Thanks in advance for any help.
You can use the
~operator within a modify-overwrite-beta transformation such as"~detail" : "@(2,updating_field)"meaning if"detail"does not exist or is null,then make it be the value of
"updating_field"after traversing 2 levels (:and{) up the tree such asthe first demo on the http://jolt-demo.appspot.com/ site is :
the second demo on the http://jolt-demo.appspot.com/ site is :
Edit : If the null and empty string (
"") values should be classifed as in the same category, then use ths size function as follows :