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

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How create JSON Document of this format using tJSONDoc?

I have a single row/record with few fields: 

someFlag: boolean

fieldString1: String

fieldString2: String

fieldString3: String

and I need to create a json document formatted like this:

 

{
  "document" : [ {    
    "settings" : [ {
      "someFlag" : true
    }, {
      "fieldString2" : "someText"
    }, {
      "fieldString3" : "SomeMoreText"
    }],
    "fieldString1" : "3068@myemail.mydomain.com"    
  } ]
}

I am using tJSONDoc (tJSONDocOutput) by JLolling to create the rest of the document, but this section has proven to be too hard.

 

Ideas or suggestions very welcome.

Labels (5)
5 Replies
Anonymous
Not applicable
Author

Hi,

 

    I have a small doubt in your requirement here. The output data for String2 and String3 are in list at different level compared to boolean value and field1. So could you please advise how you are arranging them in input side in column fashion? 

 

    Could you please advise the reason for String 2 and String 3 at different level in JSON compared to String 1?

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

Anonymous
Not applicable
Author

Hi Nikhil,
This is our requirements. Data source is a single database table row, which needs to be arranged as a relatively complex json document as per external party requirements, problematic snippet of which I described in the OP.
Anonymous
Not applicable
Author

Hi,

 

    Could you please try to create JSON conversion using the metadata area of JSON?

 

https://help.talend.com/reader/lqV2ftgSbYSEBU9Bwsd61w/hCTD2DEpip2q~4n1MxWEMg

 

   If you are facing any issues, could you please share the component screen shots so that we will know the exact issue while doing the conversion?

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

akumar2301
Specialist II
Specialist II

try this 

 

0683p000009M46X.jpg

 

Output 

 

{"document": [  {"setting":[

                                     {"flag":"true"},

                                     {"str1":"abc"},

                                    {"str2":"def"}

                                  ],

                         "str3":"xxxxx@gmail.com"

                        }

                    ]

}

Anonymous
Not applicable
Author

Thanks Abhishek and Nikhil,
However, using Talend delivered JSON components is not an option as our current solution uses those and it doesn't meet all requirements (in particular, empty fields do not get suppressed, which breaks everything), hence Talend Customer Solutions suggested trying this component from JLolling.