I am new to NiFi. My question is how can we read json file in ECMAScript while using excute script process. I want to load json file with mapping json for schema mapping.
Asked
Active
Viewed 3,661 times
0
-
By "load json file", do you mean JSON in the FlowFile content, or an external file? – James Aug 26 '16 at 23:41
-
@James - i want to load external file – Siraj ul Haq Aug 29 '16 at 10:07
1 Answers
2
I have an post on my blog about how to read in a flow file containing JSON using ExecuteScript with ECMAScript:
http://funnifi.blogspot.com/2016/03/executescript-json-to-json-revisited.html
There is also another StackOverflow question similar to your use case of reading in a mapping file and applying it to incoming data (using Groovy):
Apache NiFi ExecuteScript: Groovy script to replace Json values via a mapping file
Not sure if this helps too but I have another post on validating JSON with ExecuteScript (but Groovy not ECMAScript) using JSONSchema: http://funnifi.blogspot.com/2016/05/validating-json-in-nifi-with.html