Support Questions

Find answers, ask questions, and share your expertise

How to add a tag at the beginning of json with JoltTransformJson?

Hi, please, how to add a tag at the beginning of json with JoltTransformJson?

In the attached image I added a tag to the end of json, what syntax to add at startup?



Super Guru
@Julio Gazeta

I think you need to use another JoltTransformJson processor and keep your desired order of fields in this processor.



in the above example i have jolt spec with key values specified which order i need to get them in the resultant flow, same way you can keep your desired order in the second JoltTransformJSON processor.

You can also try using JoltTranfromRecord processor starting from NiFi-1.8 where we can specify Record Reader/Writer controller services as we can have desired order of fields.

In case if you are adding only one key/Value to your json message then consider UpdateRecord processor and keep your default values for Flag field and specify RecordReader/Writer controller services in this case you can add the field and arrange your fields in the desired order using only one processor.

Refer to this link for more details regards to UpdateRecord processor usage.

Super Guru
@Julio Gazeta

If you are trying to add header/trailer to your existing JSON then try comparing between

ReplaceText processor vs JoltTrasnformProcessor

ReplaceText Configs:

Search Value


Replacement Value

{ "messageType":["urn"], "message":{ "arquivo":$1 } }

Character Set


Maximum Buffer Size

1 MB //increase this value if flowfile size is more than 1 MB

Replacement Strategy

Regex Replace

Evaluation Mode

Entire text


By using ReplaceText processor we are adding header/trailer to the flowfile, i could say probably "JoltTransformRecord" processor will give most performance.

Please do load/performance test between JoltTransformJSON processors vs ReplaceText vs JoltTransformRecord (if you are using NiFi-1.8) and let us know which processor worked best for your case 🙂 !!

Hi Shu, in my case I just need to add a header and a trailler to my json? What would be the most performatic way to perform this procedure in nifi? Here is an example of the input of my json and how it should stay.


Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.