[resolved] tRest and map JSON with tExtractJSONField with TALEND

Highlighted
One Star

[resolved] tRest and map JSON with tExtractJSONField with TALEND

I'm quite new to Talend and I am stuck with getting JSON data using tRest.
We Suppose that I am trying to get all posts from social networks.
That's why I am using  to get data which is formatted in JSON.
Here is one of the scenarios I tried. I have an output JSON data like this from  with 2 posts as example, I removed some nodes to clarify ... :
{
"posts":
       
   },
   {
       "network": "Facebook",
       "post_id": "547835328170823680",
       "text": "#tunisia .. #tunis",
       "html": " ",
       "permalink": " ",
       "post_time": 1777449095,
       "user_id": "159995522",
       "user_name": " ",
       "user_real_name": " ",
       "user_profile_image_url": " ",
       "hashtags":        
   }
]
}

Here's the first Talend job :

And I configured tExtractJSONField to extract text field from the data as below :


In fact, I need these fields : newtork, text, post_time, and the list of hashtags.
Because of Body on the Mapping table, I think I can not add more attributes to map the rest of fields.
I found there's a way to map data with tXMLMap where the body field can be extended to add more fields :

I believe there's a way do the same thing for JSON but I dont know how and I wait for your help.

Accepted Solutions
One Star

Re: [resolved] tRest and map JSON with tExtractJSONField with TALEND

Hi,
Thanks for help, I found how to do the mapping.



Now I have a little problem, I need to extract hashtags, which are in array like this :
"hashtags":      

The problem is the node hashtags return only the first tag!
And I want to see all tags, like "tag1, tag2, ..."
I wait for your help.

All Replies
Moderator

Re: [resolved] tRest and map JSON with tExtractJSONField with TALEND

Hi,
Your screenshots are not available for us. Could you please upload your image by chicking "Upload" button or dropping your file into "Drop files here to attache them" field directly?
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.
One Star

Re: [resolved] tRest and map JSON with tExtractJSONField with TALEND

Hi,
Thanks for help, I found how to do the mapping.



Now I have a little problem, I need to extract hashtags, which are in array like this :
"hashtags":      

The problem is the node hashtags return only the first tag!
And I want to see all tags, like "tag1, tag2, ..."
I wait for your help.

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