Flatten JSON Structure

Five Stars

Flatten JSON Structure

Hi,

I have the following JSON returned from the tRest component. I need extract the data so in essence I have a list of tasks with their respective parent projectID and projectName. How can this be achieved using the tExtractJSONFields component. I ve had about 2 hours experience with Talend so a detailed explanation if possible Smiley Happy

 

{
"data": [
{
"projectID": "573c8fbe001bc563b07a8e1c908bf071",
"projectName": "UK_0182_Maidstone",
"objCode": "PROJ",
"parameterValues": {
"DESmiley Very HappyS Opening Date - Actual": "2015-07-31",
"DESmiley Very HappyS Country": "United Kingdom",
"DESmiley Very HappyS NSC / Importer": "My UK. Ltd",
"DESmiley Very HappyS Format": "Forurteco",
"DESmiley Very HappyS Region": "DEUR"
},
"estStartDate": "2016-05-18T18:52:00:000+0300",
"estCompletionDate": "2016-10-14T15:13:00:000+0300",
"lastUpdateDate": "2017-05-16T12:31:52:074+0300",
"plannedCompletionDate": "2016-10-13T15:21:00:000+0300",
"plannedStartDate": "2016-05-18T02:00:00:000+0300",
"tasks": [
{
"ID": "573c8fbe001bcdeb524c99bf8786f090",
"name": "Confirm orders placed with Supply Chain",
"objCode": "TASK"
},
{
"ID": "573c8fbe001bcc48de510aef0fc1d1c9",
"name": "Review Design Pack and issue to Brand ",
"objCode": "TASK"
}
]
}
]
}

Tags (1)
Moderator

Re: Flatten JSON Structure

Hi,

Could you please also post your expected result on forum?

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Five Stars

Re: Flatten JSON Structure

Hi,
Example of raw JSON returned from REST API

{
"data": [
{
"projectID": "573c8fbe001bc563b07a8e1c908bf071",
"projectName": "UK_0182_Maidstone",
"objCode": "PROJ",
"parameterValues": {
"DESmiley Very HappyS Opening Date - Actual": "2015-07-31",
"DESmiley Very HappyS Country": "United Kingdom",
"DESmiley Very HappyS NSC / Importer": "My UK. Ltd",
"DESmiley Very HappyS Format": "Forurteco",
"DESmiley Very HappyS Region": "DEUR"
},
"estStartDate": "2016-05-18T18:52:00:000+0300",
"estCompletionDate": "2016-10-14T15:13:00:000+0300",
"lastUpdateDate": "2017-05-16T12:31:52:074+0300",
"plannedCompletionDate": "2016-10-13T15:21:00:000+0300",
"plannedStartDate": "2016-05-18T02:00:00:000+0300",
"tasks": [
{
"taskID": "573c8fbe001bcdeb524c99bf8786f090",
"taskName": "Confirm orders placed with Supply Chain",
"objCode": "TASK"
},
{
"ID": "573c8fbe001bcc48de510aef0fc1d1c9",
"name": "Review Design Pack and issue to Brand ",
"objCode": "TASK"
}
]
}
]
}


Need to get this structure
Project ID, Project Name, DESmiley Very HappyS Country ,Task ID, Task Name

Thanks in advance

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

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch