I have tried to put tlogRow after tWriteJsonField.
Here's what I wanted to do.
1. Connect to MySQL Database.
2. Get the records.
3. Transform the records by giving renaming them using tMap
4. Convert to Json for each row (Json should be nested). So I have used tWriteJsonField.
5. Send to REST API.
On step 4, I am not able to get the proper Json. It has the empty arrays, but no null values anywhere. That's the reason I thought of using the tJavaRow to replace the empty arrays with empty string.
If anyone has any better way for my series of steps, I really appreciate your help if you let me know.
Following is the response I have got by putting tLogRow after tWriteJsonField, but the tJavaRow gave a null pointer exception. Besides that, I am having some pipe symbols after each Json which is annoying.
I would also like to know if there is way to generate a nested Json without the name for the data block like "json" in the below response.
{
"json": {
"id": "1",
"template_id": [],
"time": "2015-09-22 11:37:47",
"person_id": [],
"person1": {
"person1_email": "jon.doe@gmail.com",
"person1_first_name": "Jon",
"person1_last_name": "Doe",
"person1_mobile_phone": []
},
"person2": {
"person2_first_name": "Foo",
"person2_last_name": "Bar",
"person2_rep": "foo.bar@gmail.com",
"person2_mobile_phone": []
}
}
} || || || || || || || || || || || || | {
"json": {
"id": "1",
"template_id": [],
"time": "2015-09-22 11:37:47",
"person_id": [],
"person1": {
"person1_email": "jon.doe@gmail.com",
"person1_first_name": "Jon",
"person1_last_name": "Doe",
"person1_mobile_phone": []
},
"person2": {
"person2_first_name": "Foo",
"person2_last_name": "Bar",
"person2_rep": "foo.bar@gmail.com",
"person2_mobile_phone": []
}
}
}