The response of the API I’m testing returns an array with multiple objects and I want to save one of those value into a global variable, I know how to do this for a single entry using:
const jsonData = JSON.parse(responseBody);
pm.globals.set("my_id", jsonData.id);
but how can I do this for multiple IDs into one response? This API will always return two objects so two IDs, something like:
{
"value": [
{
"id": "FIRST_RANDOM_UUID",
},
{
"id": "SECOND_RANDOM_UUID",
}, ]
}
If possible I want to name these ID1 and ID2.