Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
bob_lemley
Contributor II
Contributor II

How do you create a JSON file with 3 levels

I am trying to create a JSON file from a database query. The JSON file is for invoices. Each file consists of a header group. The header can have multiple Lines and each line can have multiple costs. I believe with Studio you can only do two levels with the tWriteJSONField. Is that correct? Has anyone done three levels. I tried using two different tWriteJSONFields and them combining the results, but the JSON wasn't formatted correctly. Has anyone done this and would be willing to share their job?

Labels (3)
1 Reply
David_Beaty
Specialist
Specialist

I’ve done something similar, but I’m afraid I don’t have access to the job, so cannot share.

There’s a couple of ways to do this:essentially.

1-create the level 3 data 1st then join with the level 1/2 data in a tMap, then use a tJavaRow to convert the text to a JSON object yourself.

2-prepare the level data into textual arrays, which you construct into the JSON object in a tJavaRow.