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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
talendtester
Creator III
Creator III

JSON - Need help getting more than 1 row of data out

My job looks like:

tFileInputJSON > tFileOutputDelimited

 

I can get all the data for all the fields from the first JSON object fine, but I can't seem to make it loop through all the objects in the JSON file to get more than a single row of output.

 

I am trying to get all the data out for the device. In the fFileInputJSON, the Loop Json query is "$.device"

 

Here is a sample from the file:



To see the whole post, download it here
Labels (3)
1 Solution

Accepted Solutions
vboppudi
Partner - Creator III
Partner - Creator III

Please find the screen shot below for jsonextract component.

 

0683p000009Lwl0.png

Regards,

 

View solution in original post

8 Replies
Anonymous
Not applicable

Hi
The sample file is unreadable, it looks like two json strings in the file, are you able to create a metadata for this file?

Regards
Shong
talendtester
Creator III
Creator III
Author

Yes, I was only able to paste in 2 JSON strings because of the 20K character limit on the the Talend forum.

 

 

I think this is a good reduced version which can be used for troubleshooting:

 

{"guid":"stuff1","schemaRevision":1,"app":{"version":"123"},"user":[],"device":{"androidApi":1,"fingerprint":"abc","brand":"MOTO","device":"phone1"}}
{"guid":"stuff2","schemaRevision":2,"app":{"version":"456"},"user":[],"device":{"androidApi":2,"fingerprint":"def","brand":"HTC","device":"phone2"}}
{"guid":"stuff3","schemaRevision":3,"app":{"version":"789"},"user":[],"device":{"androidApi":3,"fingerprint":"ghi","brand":"LG","device":"phone3"}}
{"guid":"stuff4","schemaRevision":4,"app":{"version":"1011"},"user":[],"device":{"androidApi":4,"fingerprint":"jkl","brand":"SAM","device":"phone4"}}

vboppudi
Partner - Creator III
Partner - Creator III

Can you please provide expected output?

Regards,

talendtester
Creator III
Creator III
Author

1,abc,MOTO,phone1
2,def,HTC,phone2
3,ghi,LG,phone3
4,jkl,SAM,phone4

vboppudi
Partner - Creator III
Partner - Creator III

Hi,

Please find the job below to read json file and derive device details.

0683p000009Lwkv.png

 

Regards, 

talendtester
Creator III
Creator III
Author

Please post a screenshot of the tExtractJSONFields component's component tab.
vboppudi
Partner - Creator III
Partner - Creator III

Please find the screen shot below for jsonextract component.

 

0683p000009Lwl0.png

Regards,

 

talendtester
Creator III
Creator III
Author

Thanks! I hadn't messed with JSON much before yesterday.