I have a dynamically generated list called comments as shown below using json templater and sql creator transformers. List contains several objects and I want to generate id for every object as one of the attribute of the same object.
I also want to set an attribute called solution as a boolean true or false. But the attribute lies inside the object and cant set its data type. Is there any solution for this? I am transferring the data to Mongodb by creating a json file from sql based data.
Capture4.PNG
Â
JSON Templater code 2 is -
>fme:get-json-list-attribute("_list{}.commentObj")]
Here after mearging data from Oracle and Mongodb in Feature mearger, I am creating a json object using first json templater using below code -
First JSON Templater code -
{
"user":
{"user":fme:get-attribute("TKT_NOTESUSER"),
"username":fme:get-attribute("fullname_notesuser"),
"_id":fme:get-attribute("mongodb_id")
},
"date": fme:get-attribute("TKT_NOTESDATE"),
"comment" : fme:get-attribute("TKT_NOTES"),
"solution": fme:get-attribute("SOLUTION")
}
After this I am building a dynamic list grouped by some id and passing list to second json templater.Code for this templater is -
fme:get-json-list-attribute("_list{}.commentObj_")]
So giving me the result json file as a list of objects in json writer as shown in above image.