Support Questions

Find answers, ask questions, and share your expertise

JoltTransformRecord issue

avatar
Explorer

I have designed flow in nifi for XML to JSON converter. And for that, I have used GenerateFlow File and JoltTransformRecord(not JoltTransform JSON).

 

But I am getting null value in the JSON file with the schema(output in screen shot).

Please find my jolt specification:

[
{
"operation":"shift",
"spec":{
"to":"Receiver",
"from":"Sender",
"heading":"Heading",
"body":"Message"
}
}
]

 

Jolt Transformation DSL is chain.

 

As I am trying to convert XML to JSON and make a change in element name in one go through JoltTransformRecord. I think JoltTransformRecord accepts any form of payload and then converts it into JSON format and then applies the change in elements of the JSON file.

 

OutputOutputInput fileInput file

 

 

Please help why this happens.

 

thanks

1 ACCEPTED SOLUTION

avatar
Expert Contributor

Hi @ravi_sh_DS,
I am perfectly getting the output after using the joltTransformRecord

PVVK_0-1593349890104.png

The spec I used is the same that you mentioned in your question. I don't think that the processor is converting the xml into json at first. Had it been that case, jolt must be acting on
{

 "note":{

  "to":"...",
  "from":"...",

  "heading":"...",

  "body":"..."

 }
}
Even if the jolt is applied on the above json, your ouput will be empty json object. Can you check it once again?

View solution in original post

1 REPLY 1

avatar
Expert Contributor

Hi @ravi_sh_DS,
I am perfectly getting the output after using the joltTransformRecord

PVVK_0-1593349890104.png

The spec I used is the same that you mentioned in your question. I don't think that the processor is converting the xml into json at first. Had it been that case, jolt must be acting on
{

 "note":{

  "to":"...",
  "from":"...",

  "heading":"...",

  "body":"..."

 }
}
Even if the jolt is applied on the above json, your ouput will be empty json object. Can you check it once again?