Complete the code to extract the value of 'token' from the JSON response.
let token = pm.response.json().[1];The pm.response.json() method parses the response body as JSON. To get the 'token' value, use pm.response.json().token.
Complete the code to check if the response status code is 200.
pm.test('Status code is 200', function () { pm.response.to.have.status([1]); });
The status code 200 means the request was successful. We check it using pm.response.to.have.status(200).
Fix the error in the code to correctly extract the 'userId' from the JSON response.
let userId = pm.response.json()[1];To access a property in a JavaScript object, use dot notation without parentheses: .userId.
Fill both blanks to extract the 'email' from the first user in the 'users' array in the response.
let email = pm.response.json().[1][[2]].email;
The response has a 'users' array. To get the first user's email, access users[0].email.
Fill all three blanks to create a test that checks if the response JSON has a 'success' property set to true.
pm.test('Response has success true', function () { pm.expect(pm.response.json().[1]).to.eql([2]); pm.expect(typeof pm.response.json().[3]).to.equal('boolean'); });
We check the 'success' property equals true and that its type is boolean. Both blanks 1 and 3 refer to 'success'.