Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
root
Creator II
Creator II

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:

0683p000009MBQS.png
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.
Labels (4)
3 Replies
vapukov
Master II
Master II

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
root
Creator II
Creator II
Author

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.
vapukov
Master II
Master II

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