# Extract value from a JSON Response Body via the Test Scripts - no output

**URL:** <https://community.postman.com/t/extract-value-from-a-json-response-body-via-the-test-scripts-no-output/42715>\
**Category:** Help Hub\
**Tags:** tests\
**Created:** [January 9, 2023, 5:06pm UTC](https://community.postman.com/t/extract-value-from-a-json-response-body-via-the-test-scripts-no-output/42715 "2023-01-09T17:06:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![akashnayee](https://avatars.discourse-cdn.com/v4/letter/a/43a26b/32.png) [@akashnayee](https://community.postman.com/u/akashnayee)\
**Post date:** [January 9, 2023, 5:06pm UTC](https://community.postman.com/t/extract-value-from-a-json-response-body-via-the-test-scripts-no-output/42715/1 "2023-01-09T17:06:46Z")

</div>

I have a response with the following format

```auto
{
    "records": [
        {
            "timeStamp": "xxxxxx",
            "spaceName": "xxxxxxx",
            "spaceId": "xxxxxx",
            "type": "xxxxx",
            "message": "xxxxx",
            "user": "xxxxx"
        },
    

```

I want to extract a list of the users to use in another get request.

In my Tests script, I’ve got the following

```auto
let responseData=pm.response.json();
console.log(responseData);
pm.environment.set("user", responseData.records[0].user);

```

However when I hit send and run the request, i’m not getting any output in my ‘Test Results’ however it isn’t throwing an error either, any ideas?

---

<div class="post-metadata">

**Author:** ![david-franklin](https://avatars.discourse-cdn.com/v4/letter/d/839c29/32.png) [@david-franklin](https://community.postman.com/u/david-franklin)\
**Post date:** [January 9, 2023, 6:50pm UTC](https://community.postman.com/t/extract-value-from-a-json-response-body-via-the-test-scripts-no-output/42715/2 "2023-01-09T18:50:46Z")

</div>

Test Results (in the results panel) will only have something in it if you have a **pm.test()** method. Do you check your Variables tab to see that your environment variable is set to the 0th user?

---

<div class="post-metadata">

**Author:** ![akashnayee](https://avatars.discourse-cdn.com/v4/letter/a/43a26b/32.png) [@akashnayee](https://community.postman.com/u/akashnayee)\
**Post date:** [January 10, 2023, 9:44am UTC](https://community.postman.com/t/extract-value-from-a-json-response-body-via-the-test-scripts-no-output/42715/3 "2023-01-10T09:44:32Z")

</div>

Hi David

Figured it out thanks!

```auto
pm.test("Collect User Record", function () {
responseData = JSON.parse(responseBody)
value = responseData.records[0].user
console.log(value)
pm.environment.set("user", responseData.records[0].user)
});

```
