How to check JSON Object with special characters

Hi all,

i want to access special character (area_code and blood_type)

{
“timestamp”: 1668480108,
“datas”: {
“id”: “12345”,
“name”: “john doe”,
“address”: “avenue 12st”,
“area/code”: “001/009”,
“gender”: “Male”,
“blood_type”: “-”,
},
“id”: “135ae3”,
}

I’ve already tried:

var response = pm.response.json();

pm.test(“json have spesific response”,() =>{
pm.expect(response.datas.area/code).to.eql(“001/009”);
pm.expect(response.data.blood_type).to.eql(“-”);
});

Try this:

var response = pm.response.json();
pm.test("JSON response",() => {
    pm.expect(response.datas['area/code']).to.eql("001/009");
    pm.expect(response.datas['blood_type']).to.eql("-");
});
1 Like