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

Announcements
Streamlining user types in Qlik Cloud capacity-based subscriptions: Read the Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Extract json into columns

Dear Community, I'm pretty new In Talend and I have some trouble when I try to extract the JSON array into columns in the positional file. 

[{
		"id": 1,
		"Code": "001"
	},
	{
		"id": 2,
		"Code": "002"
	}
]

I want to have this kind of table.

.---------+-------+--------------+--.
|Column_1|Column_2|Column_3|Column_4|
|=--------+-------+----------------=|
|1       |001     |2       |002     |
'---------+-------+--------------+--'

Also, the problem is that JSON array can have more than 2 elements and accordingly the number of columns must increase.

Thanks in advance.

 

 

Labels (3)
3 Replies
Anonymous
Not applicable
Author

Hi ! 

 

In a tExtractJSONFields try this : 

Column                                      JSON request

Colulmn1                                   [0].id

Colulmn2                                   [0].code

Colulmn3                                   [1].id

Colulmn4                                   [1].code

 

This solution works if you know the number of elements you'll get and if it don't change

Anonymous
Not applicable
Author

Dear @mhodent I tried with tExtractJSONFields and yes it worked, But now I need the same with a not fixed size of an elements.

 

Anonymous
Not applicable
Author

Unfortunately, i'm sorry mate but i don't know how to do it. I've been searching for a solution but i don't have a clue.

 

Hope you'll find !