JSON Test in the response body when without variable name in array followed by nameless object

I am trying to write a test case to pull out the first object in an array that is nameless followed by objects that are arrays.

Trying to pull “this-one” for the first object in the array.

The body looks like this:

        "a": "data", 
        "this-one": 9999 
        "a": "data", 
        "this-one": 12234 

The test snippet I am trying to adapt from “Response Body: JSON value check”.

pm.test("Your test name", function () {
    var jsonData = pm.response.json();

I am having trouble figuring out what to put after jsonData.___________

This should work:


The response is an array, which contains objects so in order to access them you need to specify which object you want using [0] - Then it’s just a case of adding the key to the value you need.

1 Like