Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created 01-18-2022 03:50 AM
I have a JSON text coming in a flowfile.
{
"_id":{
"_data":"8261DB7CD7000000362B022C0100296E5A1004B9491C697A7B45E1BCDF455EB59ABC6F46645F6964006461DB7CD7564AB600124193730004"
},
"operationType":"insert",
"clusterTime":{
"$timestamp":{
"t":1641774295,
"i":54
}
}
}
I would like to be able to replace all JSON attribute names with lowercased names.
Nifi is quite new to me. Can anyone please give a sample implementation?
Thank you very much.
Created 01-18-2022 08:08 AM
You should be able to use the JoltTransformJson NiFi processor to accomplish this.
There is a thread here where a jolt specification example exists fro doing what you are trying to do:
https://stackoverflow.com/questions/54696540/jolt-transformation-lowercase-all-keys
Add the Jolt specification in to the "Jolt Specification" property in the JoltTransformJson NiFi processor. Set "Pretty Print" to true if you still want the nice multi-line formatted json to be produced.
If you found this response assisted with your query, please take a moment to login and click on "Accept as Solution" below this post.
Thank you,
Matt
Created 01-18-2022 05:57 AM
You can do this by using ExecuteStreamCommand processor. In that processor you will give a python script path. While in script you can get this data, perform your desired operation and let the data out. Link to documentation is
https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.5.0/org.apache...
Created 01-18-2022 06:20 PM
Many thanks for your guidance. I will take a look.
Created 01-18-2022 08:08 AM
You should be able to use the JoltTransformJson NiFi processor to accomplish this.
There is a thread here where a jolt specification example exists fro doing what you are trying to do:
https://stackoverflow.com/questions/54696540/jolt-transformation-lowercase-all-keys
Add the Jolt specification in to the "Jolt Specification" property in the JoltTransformJson NiFi processor. Set "Pretty Print" to true if you still want the nice multi-line formatted json to be produced.
If you found this response assisted with your query, please take a moment to login and click on "Accept as Solution" below this post.
Thank you,
Matt
Created 01-18-2022 06:22 PM
Many thanks for your guidance. I will take a look.
PS. Your numerous solutions in the past had helped me a lot.
Created 01-19-2022 05:45 AM
@Wisdomstar
Thank you, I appreciate that and glad I could help.
Matt