Hi @rakesh chow, as ExecuteScripts are experimental in NiFi but you can acheive sameresults by using another processors as follows.
1.EvaluateJsonPath //Extract all the contents to attributes
2.UpdateAttribute //Update time stamps attributes with new format(yyyy-mm-dd hh...etc)
3.AttributesToJson //Recreate Json content by specifying all the attributes
My input sample content is
"DiscoveredTime":"Mon Sep 11 19:56:13 IST 2017",
"LastDiscoveredTime":"Mon Oct 09 23:38:55 IST 2017"
in eval json processor extract all the contents of the flowfile to the attributes of flowfile by changing
Destination property to flowfile-attribute
and add new properties by clicking + sign at right corner.
so i have extracted all the content of ff as attributes of ff, in your case you need to add all your json content keys of contents here and this processor keeps all the values of content to attributes.
UpdateAttribute Processor Configs:-
This processor will helps to update the attributes on the fly we are changing our DiscoveredTime,LastDiscoveredTime attributes on the fly.
in this expression we are checking which timezone it is and converting that to number and adding 6 hrs(i think you don't need to do :plus(21600000)), after that i'm converting to yyyy-MM-dd HH:mm:ss.SSS format
In your case you need to mention all your attributes in attributes to json processor and it will prepare new json content with all your attributes, if you left this property as empty then all the attributes associated with the ff will be part of your json content.