Hi,
NiFi noobie here, so go easy on me :)
I have a flowfile attribute (let's call it "Data") that contains JSON. I
need to remove certain pairs from that JSON and then use the resulting JSON
as the body of a POST to a URL.
The flow file attribute "Data" contains the following JSON:
[{
"one": "a",
"two": "b",
"three": "c",
"four": "d"
}, {
"one": "e",
"two": "f",
"three": "g",
"four": "h"
}]
I want to remove elements "two" and "four", resulting in this JSON:
[{
"one": "a",
"three": "c"
}, {
"one": "e",
"three": "g"
}]
I'm trying to use the JoltTransformJSON processor.
My Jolt Specification is this:
[{
"operation": "remove",
"spec": {
"*": {
"two": "",
"four": ""
}
}
}]
When I test it via the Advanced button UI, it works.
But when I run the flow, I get an error:
"com.bazaarvoice.jolt.exception.JsonUnmarshalException: Unable to unmarshal
JSON to an Object"
How exactly should I be referring to the flow file attribute in the spec?
I've even tried a simple spec like this (where uuid is a flowfile attribute
that contains "foo":
[{
"operation": "default",
"spec": {
"*": {
"five": "${uuid}"
}
}
}]
Again, this works when I test it via the Advanced button UI, but I get the
same error when I run the actual flow. It feels like there's some basic
thing I'm missing.
TIA for any pointers!
--
Sent from: http://apache-nifi-users-list.2361937.n4.nabble.com/