# How to save a value from a response into variables?

**URL:** <https://community.postman.com/t/how-to-save-a-value-from-a-response-into-variables/31654>\
**Category:** Help Hub\
**Created:** [January 18, 2022, 1:21pm UTC](https://community.postman.com/t/how-to-save-a-value-from-a-response-into-variables/31654 "2022-01-18T13:21:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![avionics-saganist-75](https://avatars.discourse-cdn.com/v4/letter/a/5daacb/32.png) [@avionics-saganist-75](https://community.postman.com/u/avionics-saganist-75)\
**Post date:** [January 18, 2022, 1:21pm UTC](https://community.postman.com/t/how-to-save-a-value-from-a-response-into-variables/31654/1 "2022-01-18T13:21:34Z")

</div>

Hello! My response is {  
“response”: [  
{  
“id”: 5127975,  
“first\_name”: “John”,  
“last\_name”: “Smith”  
}  
]  
}

Could anyone show me a code how to save the value of last\_name, first\_name from the response into variables?

Thanks!🙂

---

<div class="post-metadata">

**Author:** ![kevinc-postman](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/kevinc-postman/32/12774_2.png) [@kevinc-postman](https://community.postman.com/u/kevinc-postman)\
**Post date:** [January 18, 2022, 7:21pm UTC](https://community.postman.com/t/how-to-save-a-value-from-a-response-into-variables/31654/2 "2022-01-18T19:21:35Z")

</div>

Hey there!  
First, I just want to welcome you to the Postman community and congratulations on your first post! 🎊

To store data returned in a response, you would have to write code in the “tests” part of a request.  
Here is an example from the [official postman answers workspace](https://www.postman.com/postman/workspace/postman-answers/collection/9215231-47464531-0c3f-4b21-94b8-71e48025f88f).

[This blog post](https://blog.postman.com/extracting-data-from-responses-and-chaining-requests/) is also an excellent resource for more information 😄

---

<div class="post-metadata">

**Author:** ![avionics-saganist-75](https://avatars.discourse-cdn.com/v4/letter/a/5daacb/32.png) [@avionics-saganist-75](https://community.postman.com/u/avionics-saganist-75)\
**Post date:** [January 18, 2022, 7:39pm UTC](https://community.postman.com/t/how-to-save-a-value-from-a-response-into-variables/31654/3 "2022-01-18T19:39:26Z")

</div>

Hey, Kevin! Thanks a lot for your response! I figured it out already! 😊👍

Best Regards,

Oleg Kryczewski
