Performing a JSON Deserialization in Talend

0 votes

Following is the sample of the JSON file I need to deserialize:

{
          "ryan@toofr.com": {
            "confidence":119,"email":"ryan@toofr.com","default":20
          },
          "rbuckley@toofr.com": {
            "confidence":20,"email":"rbuckley@toofr.com","default":15
          },
          "ryan.buckley@toofr.com": {
            "confidence":18,"email":"ryan.buckley@toofr.com","default":16
          },
          "ryanbuckley@toofr.com": {
            "confidence":17,"email":"ryanbuckley@toofr.com","default":17
          },
          "ryan_buckley@toofr.com": {
            "confidence":16,"email":"ryan_buckley@toofr.com","default":18
          },
          "ryan-buckley@toofr.com": {
            "confidence":15,"email":"ryan-buckley@toofr.com","default":19
          },
          "ryanb@toofr.com": {
            "confidence":14,"email":"ryanb@toofr.com","default":14
          },
          "buckley@toofr.com": {
            "confidence":13,"email":"buckley@toofr.com","default":13
          }
        }

I am accessing this data using a tAmazonMysqlInput component and with the retrieval of each line of data, I need to invoke the API which gives me the first name, the last name and the company changes every time. Following is the screenshot of my Job:image

From the API I am forwarding the data to a tExtractJSONFields component which will then send it to the tLogRow component. tLogRow component will be then displaying the extracted data on the console. But my issue is, I am not able to configure the tExtractJSONFields component to show each row data on the console via tLogRow.

Please help me in configuring the tExtractJSONFields component. For your better understanding, I am adding the snapshot of my tExtractJSONFields component’s current configuration.

image

Apr 19, 2018 in Talend by geek.erkami
• 2,320 points
235 views

1 answer to this question.

0 votes

tExtractJSONFields component helps in extracting the desired data from incoming JSON fields based on the XPath or JSONPath query. Thus while working with it, two things you must pay attention to are:

  1. a valid XPath loop point

  2. A valid XPath mapping structure

You might know that while working with XPath in Talend each value needs a unique key. Which means your input data is incorrect:image

Instead, what you can use is:

 {
      "contact": {
        "confidence":119,"email":"ryan@toofr.com","default":20
      },
      "contact": {
        "confidence":20,"email":"rbuckley@toofr.com","default":15
      },

So, now the looping point is “/contact” and the mapping for:

“Confidence” -->‘confidence’,

“Email”--> ‘email’

Remember, it becomes the opposite for the “default”.

answered Apr 19, 2018 by code.reaper12
• 3,450 points

Related Questions In Talend

0 votes
1 answer

Creating a New Project in Talend Open Studio

Before you switch over to a new ...READ MORE

answered Apr 18, 2018 in Talend by misc.edu04
• 1,380 points
167 views
0 votes
1 answer

How to generate multiple rows from a single row in Talend?

I think using tJavaFlex, tMap and tFlowToIterate ...READ MORE

answered Apr 18, 2018 in Talend by code.reaper12
• 3,450 points
910 views
0 votes
1 answer
0 votes
1 answer

Naming the output based on a column value in Talend

You can try to solve this problem ...READ MORE

answered Apr 19, 2018 in Talend by 93.lynn
• 1,550 points
208 views
0 votes
1 answer

tWaitForFile component insufficiency in Talend

Regarding your first issue, tWaitForFile component provides ...READ MORE

answered Apr 10, 2018 in Talend by geek.erkami
• 2,320 points
218 views
0 votes
1 answer
0 votes
1 answer

Closed loop in Talend

As you might know,  in Talend all ...READ MORE

answered Apr 19, 2018 in Talend by code.reaper12
• 3,450 points
256 views
0 votes
1 answer

Parsing JSON in Talend

While working with JSON files, one thing ...READ MORE

answered Apr 2, 2018 in Talend by code.reaper12
• 3,450 points
396 views
0 votes
2 answers