locked
Processing JSON string value in a JSON RRS feed

  • Question

  • Hi,

    We have embedded value pair string nested in our main JSON response like this:

    {
      "startAt": 0,
      "maxResults": 1,
      "total": 2,
      "issues": [
        {
          "id": "34335",
          "key": "ISSUE-543",
          "fields": {
            "sprints": [
              "com.atlassian.greenhopper.service.sprint.Sprint@ee2bb4a[id=398,rapidViewId=44,state=CLOSED,name=10/1 - 10/15,startDate=2019-10-01T15:05:50.138-04:00,endDate=2019-10-15T13:49:00.000-04:00,completeDate=2019-10-15T10:13:55.016-04:00,sequence=397,goal=FinishAPI!]",
              "com.atlassian.greenhopper.service.sprint.Sprint@77f42665[id=424,rapidViewId=44,state=CLOSED,name=10/15 - 11/5,startDate=2019-10-15T10:48:14.811-04:00,endDate=2019-11-05T14:25:00.000-05:00,completeDate=2019-11-05T10:30:48.904-05:00,sequence=398,goal=Demo finished]"
            ]
          }
        },
        {
          "id": "12341",
          "key": "ISSUE-123",
          "fields": {
            "sprints": [
              "com.atlassian.greenhopper.service.sprint.Sprint@ee2bb4a[id=398,rapidViewId=44,state=CLOSED,name=10/1 - 10/15,startDate=2019-10-01T15:05:50.138-04:00,endDate=2019-10-15T13:49:00.000-04:00,completeDate=2019-10-15T10:13:55.016-04:00,sequence=397,goal=FinishAPI!]",
              "com.atlassian.greenhopper.service.sprint.Sprint@77f42665[id=424,rapidViewId=44,state=CLOSED,name=10/15 - 11/5,startDate=2019-10-15T10:48:14.811-04:00,endDate=2019-11-05T14:25:00.000-05:00,completeDate=2019-11-05T10:30:48.904-05:00,sequence=398,goal=Demo finished]"
            ]
          }
        }
      ]
    }

    I want to turn it into a csv file like this:

    id,rapidViewId,state,name,startDate,endDate,completeDate,sequence,goal
    398,44,CLOSED,10/1 - 10/15,2019-10-01T15:05:50.138-04:00,2019-10-15T13:49:00.000-04:00,2019-10-15T10:13:55.016-04:00,397,"FinishAPI!"
    424,44,CLOSED,10/15 - 11/5,2019-10-15T10:48:14.811-04:00,2019-11-05T14:25:00.000-05:00,2019-11-05T10:30:48.904-05:00,398,"Demo finished"
    398,44,CLOSED,10/1 - 10/15,2019-10-01T15:05:50.138-04:00,2019-10-15T13:49:00.000-04:00,2019-10-15T10:13:55.016-04:00,397,"FinishAPI!"
    424,44,CLOSED,10/15 - 11/5,2019-10-15T10:48:14.811-04:00,2019-11-05T14:25:00.000-05:00,2019-11-05T10:30:48.904-05:00,398,"Demo finished"
    

    What is the best way to turn the string into a csv?

    Thanks.

    Monday, February 3, 2020 3:37 AM

All replies