I have this JSON as flowfile content:
{
"dates" : {
"date_file" : "20240115184407",
"ingested" : "20240217175748",
"latest_date" : "19800000",
"earliest_date" : "19800000",
"date_info" : "YYYYMMDD"
},
"parents" : {
"md5" : "86107362084b86ea64dc33dfde5e14ff",
"sha256" :
"4ffe010f3392dddb3a880f0e60a6bf35e1e41444b7e83be0746097557d555e0f"
},
"triage" : {
"filetype" : "unstructured",
"languages" : "[\"gaelic\"]",
"filename" : "gaelicTest.txt"
},
"ids" : {
"md5" : "86107362084b86ea64dc33dfde5e14ff",
"sha256" :
"4ffe010f3392dddb3a880f0e60a6bf35e1e41444b7e83be0746097557d555e0f",
"sku" : "00000"
}
}
I am trying to apply a simple JOLT transform that adds a key payload at the
same level in my json as keys dates, parents, triage, and ids.
I developed this transform - just about as simple a case you could possibly
hope for:
[
{
"operation": "shift",
"spec": {
"ids": "ids",
"parents": "parents",
"dates": "dates",
"triage": "triage",
"payload": "payload"
}
},
{
"operation": "default",
"spec": {
// if payload does not exist, then apply a default of null
"payload": ""
}
}
]
I tested this successfully here: https://jolt-demo.appspot.com/#inception .
It works.
No big surprise - this is about as simple as it gets.
Should work in nifi, right? Can't get much easier than this.
But in nifi, it throws this error:
JoltTransformJSON[id=4d6c3f69-a72e-16b2-8cfe-2a9adb9303c7] processor
is not valid: : com.bazaarvoice.jolt.exception.SpecException: Shiftr
expected a spec of Map type, got ArrayList
Why? How can I get this to work in NiFi?