Extracting JSON data from REST service

One Star

Extracting JSON data from REST service

Hello, I have a v 5.2.2. REST component calling to the NOAA v2 web service for weather station data. I'm having an issue with extracting the JSON data, however.  In 5.2.2 there isn't a ExtractFieldsJSON component to use, so I've tried two approaches 1.)the tParseJSON custom component and the 2.) tJSONNormalize.  This is a extract of the Json data -
{"results":[{"date":"2016-05-01T00:00:00","datatype":"PRCP","station":"GHCND:US1FLCR0012","attributes":",,N,","value":0},{"date":"2016-05-01T00:00:00","datatype":"SNOW","station":"GHCND:US1FLCR0012","attributes":",,N,","value":0}
For the tParseJSON component , I have tried just extracting the station identifier from the component (attached)



The mapping looks like tREST -> tParseJSON -->  tLogRow. The job executes with no error, but no data is output. I've tried the  tJSONNormalize component, but I'm not sure what values to place in the "Start Path for Extracting values" and "Delimiter for path representation". I've tried different values, but I've gotten nowhere. Does anyone perhaps recognize where my error is?
Seventeen Stars

Re: Extracting JSON data from REST service

Please set as loop path: 
$.results
To your question regarding the component tJSONNormalize:
This component returns all key-value pairs for all simple values.
In your case keep the start path for extracting empty.
The component returns the path to the current key-value-pair and the Delimiter for path representation is simply the char between the attribute names. I would set a dot here. 
In ayour case you simplle have to filter the output for the attribute-name station. The filtering can be done in a tMap or tFilterRow.
Here the documentation of the component (was also linked in the component detail page in Exchange).
http://jan-lolling.de/talend/components/help/tJsonNormalize.pdf

Re: Extracting JSON data from REST service

i want to achieve the same as @travis1585 but i am actually using tExtractJSONFields. however the first component i use is tREST, i use a REST API from JIRA and it runs without an error but only retrieves one single row...
see screenshot for my Job, in the first place i would like to retrieve all data from the REST API that i get from JIRA and later on filter for specific atributes.

NB. also i would like to add that when i use just tREST --> tLogRow, i only get the first part of the REST API JSON code... i don't get the whole REST API from JIRA. when i paste the url in the browser i do see the entire code...does anoyone know what i am doing wrong?
the URL in tREST = "https://jira..nl/rest/api/latest/search"
and the HTTP headers are: 
name: "jql" 
value: "issues=san-145
so the complete URL in the browser would be: https://jira..nl/rest/api/latest/search?jql=issue%3Dsan-145

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

6 Ways to Start Utilizing Machine Learning with Amazon We Services and Talend

Look at6 ways to start utilizing Machine Learning with Amazon We Services and Talend

Blog