How to extract JSON fields

Six Stars

How to extract JSON fields

Hi,

 

I'm looking to extract the following data from below... id, name, startDate, endDate, completeDate of each, but also need to extract startAt, isLast, and maxResults (pagination data for a loop).  I can do this in 2 different tRest/textractJSONfields but it seems unnecessary.  I was hoping someone could help me figure out how to do this in 1 set of steps.  Any help would be much appreciated!

 

{
"maxResults": 50,
"startAt": 0,
"isLast": false,
"values": [
{
"id": 16,
"self": "https://URL/jira/rest/agile/1.0/sprint/10",
"state": "closed",
"name": "Sprint 5",
"startDate": "2012-10-30T07:23:07.217-07:00",
"endDate": "2012-11-21T07:23:07.217-08:00",
"completeDate": "2012-11-26T15:44:56.080-08:00"
},
{
"id": 587,
"self": "https://URL/jira/rest/agile/1.0/sprint/555",
"state": "closed",
"name": "Sprint 1",
"startDate": "2016-10-01T13:23:00.000-07:00",
"endDate": "2016-10-28T13:23:00.000-07:00",
"completeDate": "2016-11-02T08:12:50.437-07:00",
"originBoardId": 200
}

]

}


Accepted Solutions
Eight Stars

Re: How to extract JSON fields

Try the following configuration

2.PNG1.PNG


All Replies
Eight Stars

Re: How to extract JSON fields

Try the following configuration

2.PNG1.PNG

Six Stars

Re: How to extract JSON fields

This is exactly what I was looking for thanks!  I was under the impression you should always use JSONPath when working with JSON values, is that not the case... just curious?

Eight Stars

Re: How to extract JSON fields

I've used Xpath in use cases like yours, where you have JSON lists to iterate as well as higher level objects that would be common across all list items.  You can probably accomplish with JSONPath but Xpath is pretty straightforward.

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 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 3

Read about some useful Context Variable ideas

Blog