Combine multiple json objects into one before sending response

Seven Stars

Combine multiple json objects into one before sending response

My job has three different inputs (which I am reading from MSSQL). I am creating three separate json objects from them...
Like this:


In each of the tJavaRow, I am saving the created json objects in a context variable.
I want to create a "single" json object combining all three together. How can I achieve the same so I can send it back? 
Thanks.
Twelve Stars

Re: Combine multiple json objects into one before sending response

variant#1 - save it not to variables, but to csv files (without tJSONWrite), than read all 3 and make 1 JSON
variant#2 - concat 3 variables into result JSON string, this variant need more understanding of saved JSON formats - may be need cut-off leading and trailing {} and etc
variant#3 - use Java function - example1   example 2
-----------
Seven Stars

Re: Combine multiple json objects into one before sending response

variant#1 - save it not to variables, but to csv files (without tJSONWrite), than read all 3 and make 1 JSON
variant#2 - concat 3 variables into result JSON string, this variant need more understanding of saved JSON formats - may be need cut-off leading and trailing {} and etc
variant#3 - use Java function - example1   example 2

I forgot to mention, I am actually using Variant#2 as a temporary workaround till I find a cleaner solution... I am not comfortable with manipulating the data... it could get messy in the longrun.
So for Variant#1, you are suggesting I write the json object to csv files? Then, how can I combine them to make a single json.
I will check Variant#3..
Thanks again.
Twelve Stars

Re: Combine multiple json objects into one before sending response

variant#1 - may be wrong for JSON, need to test - it work with XML, but look like not work with JSON
   
-----------