Talend Connect
Virtual Summit
JOIN US!
And visit the Customer
& Community Lounge.
May 27-28, wherever you are.

Getting JSON fields from JSON array with XPATH

Highlighted
Six Stars

Getting JSON fields from JSON array with XPATH

My JSON looks like this
{
"ORDER": ,
"HELP_NR": "554-5774"
}

How can I get fields out from JSON with XPATH ? The problem is that the number of JSON elements varies. Sometimes is 3, Sometimes is 4 and Sometimes is 2?
So JSON sometimes look like this:
{
"ORDER": ,
"HELP_NR": "554-5774"
}

My job looks like this:
tFileInputJSON -- tLogRow
I would like my tLogRow to look like this:
.--------------------.
|     tLogRow_2      |
|=------------------=|
|Name                |
|=------------------=|
|Mike|
'--------------------'
|Linda|
'--------------------'
|Danny|
'--------------------'
Highlighted
Six Stars

Re: Getting JSON fields from JSON array with XPATH

Hi sebast
I sent the solution
Please look at the snapshot's.
 
Best regards,
Alfonso Borre
skype : alfonso.borre
Highlighted
Six Stars

Re: Getting JSON fields from JSON array with XPATH

I tested and it works. This is just what I need for now. Thanx. 
Highlighted
Six Stars

Re: Getting JSON fields from JSON array with XPATH

I added new JSON object which has array of objects. So my new JSON looks this:
{
    "ORDER": ,
    "HELP_NR": "554-5774",
    "TEAM":
}

I wonder how can I get "NAME_T" values as well?
I was able to get this out, and it is not quite what I wanted:
.-----+--------+------.
|      tLogRow_1      |
|=----+--------+-----=|
|NAME |HELP_NR |NAME_T|
|=----+--------+-----=|
|Mike |554-5774|      |
|Linda|554-5774|      |
'-----+--------+------'

I would like that under "NAME_T" would be 'Orange' and 'Pink'.
And on the picture you can see the settings in the tFileInputJSON:

How can I do that ?

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Talend API Designer – Technical Overview

Take a look at this technical overview video of Talend API Designer

Watch Now

Getting Started with APIs

Find out how to get started with APIs

Read