Read jSON with multiple data

Five Stars

Read jSON with multiple data

Hi there,

 

I´m in trouble in reading data from a jSON-File with the following input:

 

{
"accountid": "AEX6376734",
"exhibitortype": "New Exhibitor",
"street": "Teststreet 1234",
"city": "Test City",
"email": "test@test.com"
"contact": {
"firstname": "Frank",
"lastname": "Master",
"contactphone": "+49 342823873",
"contactfax": null,
"contactmobile": null,
"contactemail": null,
"gender": null,
"salutation": null
}
}
{
"accountid": "AEX734875448",
"exhibitortype": "New Exhibitor",
"street": "Teststreet 5678",
"city": "Test City2",
"email": "test123231@test.com"
"contact": {
"firstname": "Robert",
"lastname": "Master",
"contactphone": "+49 12345",
"contactfax": null,
"contactmobile": null,
"contactemail": null,
"gender": null,
"salutation": null
}
}

 

I tried to create a meta-schema for this jSON but I only get the first data of this jSON. So it seems that it don´t iterate over the rest of the file.

So my result must return two sets of data.

 

AccountID: AEX6376734

AccountID: AEX734875448

 

My solution should be:

 

tFileInputJson -> tIterateToFlow -> tLogRow to test if it works.

 

Is anyone able to show me a solution how to read all the data iterated into tLogRow? How should I define loop element if I don´t have a group element.

 

Thx for your help.

 

 

Nine Stars

Re: Read jSON with multiple data

How about something like this - tFileInputJSON - main - tMap - main - tLogRow

 

Job Layout - 

tFileInputJSON-3.JPGtFileInputJSON-4.JPGtMap-TC3.JPGAlso, your json seems to be wrong and doesn't get validated. It should be something like this - 

		[{
			"accountid": "AEX6376734",
			"exhibitortype": "New Exhibitor",
			"street": "Teststreet 1234",
			"city": "Test City",
			"email": "test@test.com",
			"contact": {
				"firstname": "Frank",
				"lastname": "Master",
				"contactphone": "+49 342823873",
				"contactfax": null,
				"contactmobile": null,
				"contactemail": null,
				"gender": null,
				"salutation": null
			}
		}, {
			"accountid": "AEX734875448",
			"exhibitortype": "New Exhibitor",
			"street": "Teststreet 5678",
			"city": "Test City2",
			"email": "test123231@test.com",
			"contact": {
				"firstname": "Robert",
				"lastname": "Master",
				"contactphone": "+49 12345",
				"contactfax": null,
				"contactmobile": null,
				"contactemail": null,
				"gender": null,
				"salutation": null
			}
		}]
Nine Stars

Re: Read jSON with multiple data

How about something in the line of tFileInputJSON - > main - > tMAP -> main -> tLogRow

tFileInputJSON-3.JPGtFileInputJSON-4.JPGtMap-TC3.JPG

Calling Talend Open Studio Users

The first 100 community members completing the Open Studio survey win a $10 gift voucher.

Start the survey

2019 GARNER 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

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download