BACKGROUND:
I want to alter my JSON slightly from
{
"d0" : 0.0,
"d1" : 0.0,
"d2" : 0.0,
"d3" : 0.0,
"d4" : 0.0,
"d5" : 0.0,
"d6" : 0.0,
"d7" : 0.0
}
to
{ "d0" : [0.0],
"d1" : [0.0],
"d2" : [0.0],
"d3" : [0.0]
"d4" : [0.0],
"d5" : [0.0],
"d6" : [0.0],
"d7" : [0.0]
}
and I am following the reply to the question given here https://community.cloudera.com/t5/Support-Questions/Groovy-Script-in-ExecuteScript-Processor-To-Format-Date/td-p/230207
Accordingly, I use-
1.EvaluateJsonPath 2.UpdateAttribute 3.AttributesToJson
and that part of my Nifi processing looks like this
My settings for the 3 processors are -
1.EvaluateJsonPath
settings/ configuration for EvaluateJsonPath
2.UpdateAttribute
settings/ configuration for UpdateAttribute
3.AttributesToJson
settings/ configuration for AttributesToJson
But the AttributesToJson just changes the order of the data in the flat JSON to be
{
"d4" : [0.0],
"d5" : [0.0],
"d6" : [0.0],
"d7" : [0.0],
"d0" : [0.0],
"d1" : [0.0],
"d2" : [0.0],
"d3" : [0.0]
}
QUESTION:
Why is the AttributesToJson behaving this way? How should I change it to the correct order starting d0 to d7? I need the correct order because this is supposed to be the body of a POST request.