Unable to extract value from Jason response

I am facing an issue with extracting value from Json response body.

I have a JSON response

    "abc": [
        { "xyz": {
                "date": "2019-06-03T11:06:53.000Z"

and I want to get the value of date and assign it to an environment variable.

I have created a script for this as below:

var jsonData = pm.response.json();

this throws error

There was an error in evaluating the test script: TypeError: Cannot read property ‘date’ of undefined

Can anyone help me with this?

Hey @atuldanave24

Welcome to the community :wave:

I wrote some information in this post that will help you understand what’s going on here:

Thanks @dannydainton.
Now it is working after considering it as array.

1 Like