I’m trying to parse this REST API response:
{
"expand": "names,schema",
"startAt": 0,
"maxResults": 50,
"total": 1,
"issues": [
{
"expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields",
"id": "2276831",
"key": "AAINDEMA-163",
"fields": {
"customfield_20823": "{\"ducketId\":\"2\",\"rows\":[{\"rowId\":\"row_db213763-362a-4cad-abc8-d0c4acb8e2c8\",\"columns\":{\"Category\":{\"label\":\"Development\",\"value\":\"Development\",\"optionObject\":{\"label\":\"Development\"}},\"Month\":{\"label\":\"January\",\"value\":\"January\",\"optionObject\":{\"label\":\"January\"}},\"Supplier\":{\"label\":\"PANEL - Development\",\"value\":\"PANEL - Development\",\"optionObject\":{\"label\":\"PANEL - Development\"}},\"Year\":{\"label\":\"2022\",\"value\":\"2022\",\"optionObject\":{\"label\":\"2022\"}},\"Time Units\":100,\"BL Assignable\":{\"label\":\"Yes\",\"value\":\"Yes\",\"optionObject\":{\"label\":\"Yes\"}}},\"order\":0},{\"rowId\":\"row_d962557e-c742-443b-a912-3d047c2a4151\",\"columns\":{\"Category\":{\"label\":\"Certification\",\"value\":\"Certification\",\"optionObject\":{\"label\":\"Certification\"}},\"Month\":{\"label\":\"February\",\"value\":\"February\",\"optionObject\":{\"label\":\"February\"}},\"Supplier\":{\"label\":\"PANEL - Development\",\"value\":\"PANEL - Development\",\"optionObject\":{\"label\":\"PANEL - Development\"}},\"Year\":{\"label\":\"2022\",\"value\":\"2022\",\"optionObject\":{\"label\":\"2022\"}},\"Time Units\":200,\"BL Assignable\":{\"label\":\"Yes\",\"value\":\"Yes\",\"optionObject\":{\"label\":\"Yes\"}}},\"order\":1}]}"
}
}
]
}
I’m using $issues as Data Path, which parse the response like this:
But what I need is something more complex, value from customfield_20823 is also a json formatted as string, I need to get inner “rows” array and parse the objects inside, and for each row on that array create one row for my dataset having common attributes like “key” also on each row, so my expected result would be something like this:
key | Category | Month | Supplier | Year | Time Units |
---|---|---|---|---|---|
AAINDEMA-163 | Development | January | PANEL - Development | 2022 | 100 |
AAINDEMA-163 | Development | February | PANEL - Development | 2022 | 200 |
Is this possible using Custom JavaScript code or any other way that does not require admin privileges?
Thanks,
Marlen