1

In Postman I am trying to grab the value from keys which contain '@' at the beginning and ':' in the middle of them. I can get the first one (@id) by using jsonData['@id']

For example:

let jsonData = pm.response.json();

pm.test("Body contains string", function () {
    pm.expect(jsonData['@id']).to.contain("v22");
});

But I can't get to '@type'. I tried.....

 pm.expect(jsonData['hydra:member'][0].['@type']).to.contain("Campus");

However I was unable to get it from the response below.....

 {
            "@context": "/v1/contexts/System",
            "@id": "/v22/systems",
            "hydra:member": [
              {
                "@type" : "Campus"
                   "id" : "01TRD456785"
      
        
              }
             ],

1 Answers1

1

I got it.......

pm.expect(jsonData['hydra:member'][0]['@type']).to.contain("Campus");