Forum Discussion
Hi ,
Here is one example how can you achieve the result as in your example in the question above.
{
“interface”: {
“type”: “INVOICE”,
“client”: “SQLServer”
},
“data”: {
“batch_table”: {
“BATCH_ID”: 1
},
“transactions_table”: [{
“TRANSACTION_ID”: 1,
“AMOUNT”: 5.90
}, {
“TRANSACTION_ID”: 2,
“AMOUNT”: 11.20
}
]
}
}
Transform_SQL_JSON_Results.slp (5.0 KB)
In the pipeline, I took the example data, and transformed it as csv, so I put it inside “CSV Generator” snap.
Later, in order to form the array for “transactions_table”, with snap “Group By Fields”, the data is grouped by type, client and batch_id, so the result looks like this
At the end, with the snap “JSON Generator” the output is formed as you expected to be, using apache velocity
I hope this will resolve your problem.
Regards,
Angela.
That worked, thank you so much!