Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

tWriteJsonField auto remove '[' if the group has only one item

Hi,

 

I use tWriteJsonField to generate json from my database, its content is like this

 

0683p000009M98k.png

When I run the job, if the group contains more than 1 element, the '[' and the ']' appear to group the items, but if there is only one item in the group, they display as normal item without '[' and ']'.

0683p000009M96B.png

Because the next usage require this is a collection, so that the [ and ] is important to me. How can I keep them even if there is only one item in the group?

 

Thanks 

Labels (2)
1 Reply
Anonymous
Not applicable
Author

Hi all,

To work arround, I use a tMap to replace the string as follow:

            row2.request.replace("\"items\":{", "\"items\":[{").replace("}}}", "}}]}")

It work fine for me, but I believe this may be a bug (correct me if it is not)

0683p000009M93v.png0683p000009M92x.png