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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
McJingles
Contributor III
Contributor III

How to set the values as tag name in JSON output

Hey,

 I want to get the JSON output by using the CSV file. If the input like below,

 

category_id;item_id;quantity

12;98;100

12;27;48

12;98;50

 

and I want to get output like below

 

{
  "applicationMap": {
     "applications": {
       "12": {               
         "98": 100,
         "27": 48,
         "98": 50,
           }
        }
    }
}
 
Please let me know if there is any way to do it.
Thanks in Advance.!!
Labels (3)
3 Replies
root
Creator II
Creator II

I suggest using tJsonDoc component from the Talend Exchange.

https://exchange.talend.com/#marketplaceproductoverview:marketplace=marketplace%252F1&p=marketplace%...

I have used tWriteJsonField component, it can achieve this, but, its not too powerful compared to tJsonDoc. If you can share what you have currently setup, we can try to generate the required output.
McJingles
Contributor III
Contributor III
Author

Thanks for the reply @mbocquet 

 

Let's take a look at what I've done here

0683p000009M9iY.jpg

 

Gave the CSV metadata and extract the columns which I need to generate the JSON using Tmap.

 

0683p000009M9id.jpg

 

And convert the extracted values as JSON output by using TwriteJson. The output is looking like below

 

0683p000009M9gn.jpg

 

But I want to get the output like below.

 

{
    "applicationMap": {
        "applications": {
            "1266001": {
               "986373001": 17.78,
               "986368001": 48,
               "986383001": 48,
           }
        }
   }
}
    

On that place of invoice_id tag, I want to set the value as Tag name and same in the item_id tag too.

 

I don't need that tag names. Just I want to extract the values from that CSV file.

 

McJingles
Contributor III
Contributor III
Author

If anyone knows the solution please let me know...!!!!