# Access value in request.cookies object array

**URL:** <https://community.hubspot.com/t/access-value-in-request-cookies-object-array/43758>\
**Category:** CMS Development\
**Created:** [September 13, 2021, 10:38pm UTC](https://community.hubspot.com/t/access-value-in-request-cookies-object-array/43758 "2021-09-13T22:38:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![DevM](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/devm/32/101739_2.png) [@DevM](https://community.hubspot.com/u/DevM)\
**Post date:** [September 13, 2021, 10:38pm UTC](https://community.hubspot.com/t/access-value-in-request-cookies-object-array/43758/1 "2021-09-13T22:38:12Z")

</div>

I’m using the following code to retreive and display the cookie info from my site:

{% set user\_info = [request.cookies.officerInfo] %}  
{{user\_info}}

{{user\_info}} successfully displays the information in the cookie like this:

{“fname”:“Admin”,“lname”:“Testing”,“crm\_id”:“010101”}

I have a field in a 3rd party form where I need to put the crm id “010101”.

I’ve tried various things like {{user\_info.crm\_id}} or {{user\_info[2]}} without success.

Can someone help point me in the right direction? Thanks!

---

<div class="post-metadata">

**Author:** ![Teun](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/teun/32/28739_2.png) [@Teun](https://community.hubspot.com/u/Teun)\
**Post date:** [September 14, 2021, 6:36am UTC](https://community.hubspot.com/t/access-value-in-request-cookies-object-array/43758/2 "2021-09-14T06:36:34Z")

</div>

Hi @DevM ,

Why are you wrapping the request.cookies in an array? ([request.cookies.officerInfo])  
Does it not work if you use {% set user\_info = request.cookies.officerInfo %} ?

Could you use the |pprint filter to check the output of user\_info? {{user\_info|pprint}}

---

<div class="post-metadata">

**Author:** ![DevM](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/devm/32/101739_2.png) [@DevM](https://community.hubspot.com/u/DevM)\
**Post date:** [September 14, 2021, 3:53pm UTC](https://community.hubspot.com/t/access-value-in-request-cookies-object-array/43758/3 "2021-09-14T15:53:46Z")

</div>

I tried a variety of things and had left the brackets by accident on my question - thank you for catching that.

Using pprint helped me see what the output was but I’m still trying to narrow my selection down.

---

<div class="post-metadata">

**Author:** ![miljkovicmisa](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/miljkovicmisa/32/86357_2.png) [@miljkovicmisa](https://community.hubspot.com/u/miljkovicmisa)\
**Post date:** [September 14, 2021, 7:43am UTC](https://community.hubspot.com/t/access-value-in-request-cookies-object-array/43758/4 "2021-09-14T07:43:48Z")

</div>

Hello @DevM , since `{{user_info}}` returns a json string, you can convert that to a hubl object with the `fromjson` so you can access its keys like you tried to. So the snippet would look something like this:

```lia-code-sample
{% set user_info_json = user_info %}
{% set user_info_obj = user_info_json|fromjson %}<br>
{{user_info_obj.crm_id}}

```

You can learn more about the [`fromjson` filter right here in this link](https://developers.hubspot.com/docs/cms/hubl/filters#fromjson).

_ **If my answer was helpful please mark it as a solution.** _

---

<div class="post-metadata">

**Author:** ![Teun](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/teun/32/28739_2.png) [@Teun](https://community.hubspot.com/u/Teun)\
**Post date:** [September 14, 2021, 7:49am UTC](https://community.hubspot.com/t/access-value-in-request-cookies-object-array/43758/5 "2021-09-14T07:49:53Z")

</div>

Yep, this is most likely the solution. Thanks @miljkovicmisa !

---

<div class="post-metadata">

**Author:** ![DevM](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/devm/32/101739_2.png) [@DevM](https://community.hubspot.com/u/DevM)\
**Post date:** [September 14, 2021, 3:58pm UTC](https://community.hubspot.com/t/access-value-in-request-cookies-object-array/43758/6 "2021-09-14T15:58:21Z")

</div>

This is what I needed! Thank you so much!
