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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Strange tExtractJsonFields behaviour

Hi, I have JSON document stored in DB table and I need to extract those data in order to write them on MySQL. Here's an example of a JSON field I want to parse:

 

[{"val":"0","slotId":"T1","slotType":"ABS"},{"val":"0","slotId":"T2","slotType":"ABS"},{"val":"0","slotId":"T3","slotType":"ABS"},{"val":"0","slotId":"T4","slotType":"ABS"},{"val":"0","slotId":"TOT","slotType":"ABS"}]

and here's my tExtractJSONFields configuration:0683p000009Lx3L.jpg

Everything semmed to work but results are not like expected. In particular what I want is all same pod values on the same row, I got this instead:

0683p000009Lwzs.jpg

 

What am I missing?

Labels (3)
7 Replies
vboppudi
Partner - Creator III
Partner - Creator III

Hi Are you looking for the following output?

0683p000009Lwce.png0683p000009LxIi.png0683p000009LxIn.png0683p000009LxIx.png

Regards,

Anonymous
Not applicable
Author

Hi, Thank you for your reponse! I see you've set max function in tAggregateRow and this is not what I want.... suppose I've a DB with million of JSON documents like the one I've posted before and for each of them I need a row with all "Tx" fields (plus an ID field in order to join with other tables). I tried to replicate your configuration on my sample dataset which contains just 5 json entries, 2 of them lack of "T4" field. My sample dataset look like this:

0683p000009LwCm.jpg

 

And this is what I expect to see:

 0683p000009LxAz.jpg

 

 

 

Thank you for your help!

vboppudi
Partner - Creator III
Partner - Creator III

Please provide data in file if possible.

 

Regards,

vboppudi
Partner - Creator III
Partner - Creator III

please try below

0683p000009LwfO.png0683p000009LxLI.png0683p000009LxGT.png0683p000009LwoB.png

Regards,

Anonymous
Not applicable
Author

here's the requested sample 0683p000009MACn.png


sample.xlsx
vboppudi
Partner - Creator III
Partner - Creator III

Hi,

 

please follow the new approach.

0683p000009LxLN.png

Regards,

Anonymous
Not applicable
Author

Cool, much better, pretty close... btw if you look at desired table posted above, I have two NULL values in T4 column due to missing field in corresponding jsons and I really need to keep this information. I tried to substitute zero in row2.slotId.equals("T2")?Float.parseFloat(row2.val):0  with null or even leaving it empty (I slightly modified your code since I want my data to be float type) but talend returns an error