I have a test in Postman where I do a post request and need to parse the json response
The response looks like this:
{
"name": "John Doe",
"id": "123",
"children": [{
"id": "A1",
"name": "Jane Doe"
}, {
"id": "A2",
"name": "Jack Doe"
}]
}
I need to get all the 3 id's from the reponse and store them into a variable. I tried with this:
var data = JSON.parse(responseBody);
postman.setGlobalVariable("nameId", data.id);
In that way the id 123 is stored into nameId. Question is how do I parse and store the A1 and A2 id's into variables?
Aucun commentaire:
Enregistrer un commentaire