Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Trying to read Json File

Hi Experts,

 

I am learning Talend and Struggling with the below Scenario.

 

I have an JSON input file which i am unable to read using Talend.

I tried JSON Path,Xpath, but its not working.

Can any anyone help me out regarding this issue.

 

The JSON file :

 

{"CustomersInfo":[{"Customers":"{\"CustomerName\":\"DATA-27368-Imp Org1\",\"CustomerTypeCode\":\"ORGANIZATION\",\"Address\":\"DATA-27368-1-100 Oracle Parkway\",\"SiteIdentifyingAddressIndicator\":\"Y\",\"CustomerAccountTypeName\":[],\"AccountNumber\":\"DATA-27368-1-ACCT-1\"}"},{"Customers":"{\"CustomerName\":\"Demo Customer\",\"CustomerTypeCode\":\"ORGANIZATION\",\"Address\":\"Any Street 123\",\"SiteIdentifyingAddressIndicator\":\"Y\",\"CustomerAccountTypeName\":\"External\",\"AccountNumber\":\"8002\"}"}]}

 

Labels (1)
2 Replies
DBLONDEL1643728674
Contributor III
Contributor III

Hello, I am not an exert but I played with such structure by using metadata ... I experimented more or less the same getting such json structure from a REST API.

 

first I start with notepad++ suppressing \ by empty caracters ... Then, quite often, do not ask me why, you have wrong " in some places : just before { or just after }

 

in the end you have :

 

{

"CustomersInfo": [

{

"Customers": {

"CustomerName": "DATA-27368-Imp Org1",

"CustomerTypeCode": "ORGANIZATION",

"Address": "DATA-27368-1-100 Oracle Parkway",

"SiteIdentifyingAddressIndicator": "Y",

"CustomerAccountTypeName": [],

"AccountNumber": "DATA-27368-1-ACCT-1"

}

},

{

"Customers": {

"CustomerName": "Demo Customer",

"CustomerTypeCode": "ORGANIZATION",

"Address": "Any Street 123",

"SiteIdentifyingAddressIndicator": "Y",

"CustomerAccountTypeName": "External",

"AccountNumber": "8002"

}

}

]

}

 

then I go to Json MetaData, create an input

then I continue ...

 

I save it and reuse it in a tExtractJson ... and invalid caracters that we identified at the begining are no longer an issue ... again, do not asked me why ... but it works ...

DBLONDEL1643728674
Contributor III
Contributor III

0695b00000DtZNgAAN.jpg