Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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
Dear @mhodent I tried with tExtractJSONFields and yes it worked, But now I need the same with a not fixed size of an elements.
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 !