# How to save a value from response as a environment variable

**URL:** <https://community.postman.com/t/how-to-save-a-value-from-response-as-a-environment-variable/11000>\
**Category:** Help Hub\
**Tags:** tests, variables\
**Created:** [February 25, 2020, 11:57am UTC](https://community.postman.com/t/how-to-save-a-value-from-response-as-a-environment-variable/11000 "2020-02-25T11:57:01Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![aalamakowiecc](https://avatars.discourse-cdn.com/v4/letter/a/977dab/32.png) [@aalamakowiecc](https://community.postman.com/u/aalamakowiecc)\
**Post date:** [February 26, 2020, 1:25pm UTC](https://community.postman.com/t/how-to-save-a-value-from-response-as-a-environment-variable/11000/5 "2020-02-26T13:25:50Z")

</div>

hello @danny-dainton,  
I have one more question - I moved to next requests, and I tried to use similar structure in Test sections for a different request:

```
var jsonData = JSON.parse(responseBody);
pm.environment.set("eventId", jsonData["event_id"]);

```

but currently, instead of event\_id in variable value I’m getting `null`, any idea why? This is the response of the request:

```
{
    "events": [
        {
            "event_id": "23423werwer234",
            "event_location": "theatre"
	    }
    ]
}
```

---

_[View the full topic](https://community.postman.com/t/how-to-save-a-value-from-response-as-a-environment-variable/11000)._
