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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

JSON field extraction - simple array and key-value-pairs

Hello everyone

 

I have two JSON questions.

 

Consider below input JSON fragment coming from JSON Input File:

 

"source":{
other JSON fields here ....
"NetworkIdList":["networkdevice_1","networkdevice_2","networkdevice_3"],
"KeyValuePairs":{"Gearbox":"Automatic","Drive":"FrontWheelDrive","BodyStyle":"SUV","Make":"Mitsubishi"},
other JSON fields here ....
}

 

The JSON is in BOLD font.

 

Q(1) simple array extraction (no sub-fields inside array elements)
Q(2) Key-Value-Pair extraction

 

Output desired: for JSON simple array marked as Q(1)

 

NetworkID:
networkdevice_1
networkdevice_2
networkdevice_3

---------------------------------------------

Output Desired: for JSON key-value-pair Q(2)

 

Key              Value:
Gearbox      Automatic
Drive           FrontWheelDrive
BodyStyle   SUV
Make           Mitsubishi

 

Please give me some hints how I can do this inside Talend DI job. 

I am willing to write some Java if it helps me to solve this problem.

 

Thanks in advance

 

Labels (4)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

tNormalize works for both, thanks!

View solution in original post

3 Replies
jilanisyed
Creator
Creator

Hi Yuri

1.for extracting simple array you can configure the input json as following image and use tnormalize component to split the rows

tfileinputjson-->tnormalize-->tlogrow

 0683p000009LvSt.png

Anonymous
Not applicable
Author

Many thanks, I will try this out.

any further guidance re my question (2) key-value-pairs would be most appreciated, I am sure this is a common pattern that occurs in real production applications.


Anonymous
Not applicable
Author

tNormalize works for both, thanks!