I have a json record that contains array "mylst":
{
"id": 0,
"name": "Root",
"mylist": [{
"id": 10,
"info": "2am-3am"
},
{
"id": 11,
"info": "3AM-4AM"
}
]
}
I tested Jolt spec:
[
{
"operation": "shift",
"spec": {
"mylist": {
"*": {
"id": "mylist-&1-id",
"info": "mylist-&1-info"
}
},
"*": "&"
}
}
]
to transform it into "flat" version:
{
"id": 0,
"name": "Root",
"mylist-0-id":10,
" mylist-0-info":"2am-3am",
"mylist-1-id": 11,
"mylist-1-info": "3AM-4AM"
}
However, when I put it all together to print into the file, only "root"
properties are printed:
GetFile->JoltTransformJson
I have the following exception in Jolt:
java.lang.NullPointerException: null
at java.util.ArrayList.addAll(ArrayList.java:581)
at com.bazaarvoice.jolt.defaultr.Key.applyChildren(Key.java:158)
at com.bazaarvoice.jolt.Defaultr.transform(Defaultr.java:242)
at
org.apache.nifi.processors.standard.util.jolt.TransformUtils.transform(TransformUtils.java:30)
at
org.apache.nifi.processors.standard.JoltTransformJSON.onTrigger(JoltTransformJSON.java:277)
at
org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
at
org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1165)
at
org.apache.nifi.controller.tasks.ConnectableTask.invoke(ConnectableTask.java:203)
at
org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:117)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
2018-09-04 16:10:55,008 INFO [Flow Service Tasks Thread-1]
o.a.nifi.controller.StandardFlowService Saved flow controller
org.apache.nifi.controller.FlowController@4dd21cb1 // Another save pending
= false
Any idea what I do wrong?