Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] How to convert JSON string with loop elements into another JSON format

Hi,
I have one JSON string like below:
{
        "taglist": ,
        "errcode": 0,
        "errmsg": "ok"
    }


As you see, taglist is an array. I want to convert this JSON string into another format like:
{
       "tags":
}

How to do it?
Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Thank you , Lin.
After tried with a few scenarios, I feel tWriteJSONField is not feasible enough to cater for complex JSON format. I have changed to use tJSONDoc* component which are available in Exchange. 

View solution in original post

5 Replies
Anonymous
Not applicable
Author

0683p000009MAtF.png 0683p000009MB0K.png 0683p000009MB0Y.png 0683p000009MAmw.png
_AnonymousUser
Specialist III
Specialist III

I use these tools to validate and share json data Json Viewer and Json Formatter
Anonymous
Not applicable
Author

Thanks, Lin.
This approach works for now. 
Because it relies on "Group by" feature on tWriteJSONField to output one single line, this approach only works for constant count. 
What to do if count has different value? E.g. 
{
       "tags":
}
Anonymous
Not applicable
Author

Hello seanzhang1212,
You can just create a field 'bidon'(french) and you don't use it at the end. I take the same exemple, if the field 'bidon' is 'count', you delete just the link of the 'count' in the component tWriteJSONField. I hope that is understandable for you.
Anonymous
Not applicable
Author

Thank you , Lin.
After tried with a few scenarios, I feel tWriteJSONField is not feasible enough to cater for complex JSON format. I have changed to use tJSONDoc* component which are available in Exchange.