# Possible Bug in Arrays / Objects inside Macros

**URL:** <https://community.hubspot.com/t/possible-bug-in-arrays-objects-inside-macros/20751>\
**Category:** CMS Development\
**Created:** [May 11, 2020, 1:06pm UTC](https://community.hubspot.com/t/possible-bug-in-arrays-objects-inside-macros/20751 "2020-05-11T13:06:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![igcorreia](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/igcorreia/32/26131_2.png) [@igcorreia](https://community.hubspot.com/u/igcorreia)\
**Post date:** [May 11, 2020, 1:06pm UTC](https://community.hubspot.com/t/possible-bug-in-arrays-objects-inside-macros/20751/1 "2020-05-11T13:06:31Z")

</div>

I have this input:

```auto
{%- set value = ['"key"','"value"'] %}
{%- set values = {'"key"':'"value"'} %}
{{ value }}
{{ values }}

```

and this is the output:

`["key", "value"] {"key"="value"}`

---

<div class="post-metadata">

**Author:** ![Kevin-C](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/kevin-c/32/34570_2.png) [@Kevin-C](https://community.hubspot.com/u/Kevin-C)\
**Post date:** [May 11, 2020, 4:12pm UTC](https://community.hubspot.com/t/possible-bug-in-arrays-objects-inside-macros/20751/2 "2020-05-11T16:12:02Z")

</div>

Hey @igcorreia

Could you possibly ellaborate on the potential bug?

What output are you expecting?

---

<div class="post-metadata">

**Author:** ![igcorreia](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/igcorreia/32/26131_2.png) [@igcorreia](https://community.hubspot.com/u/igcorreia)\
**Post date:** [May 11, 2020, 4:34pm UTC](https://community.hubspot.com/t/possible-bug-in-arrays-objects-inside-macros/20751/3 "2020-05-11T16:34:01Z")

</div>

Sure, this is my Macro:

```auto
{%- set macros = true %}
{%- macro demo(param, type) %}
{% set value = ['"key"','"value"'] %}
{% set values = {'"key"':'"value"'} %}
{{ value }}
{{ values }}
{%- endmacro %}

```

if you notice my second result:

`{"key"="value"}` \_\_\_\_\_\_\_|  
You can notice an equal (=), I don’t think it is supposed to be there, is it?

That is bug **number 1** , bug **number 2** is this one:  
**This code does not work:**

```auto
{%- set macros = true %}
{%- macro demo() %}
{‌% set dict_var = {'name': 'Cool Product', 'price': '$20', 'size':'XL'} %} 
{‌% for key, val in dict_var.items() %}
 {‌{ key }}: {‌{ val }}<br>
{‌% endfor %}
{%- endmacro %}

```

Hope this helps.

---

<div class="post-metadata">

**Author:** ![Kevin-C](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/kevin-c/32/34570_2.png) [@Kevin-C](https://community.hubspot.com/u/Kevin-C)\
**Post date:** [May 11, 2020, 4:48pm UTC](https://community.hubspot.com/t/possible-bug-in-arrays-objects-inside-macros/20751/4 "2020-05-11T16:48:02Z")

</div>

In your first issue I’m assuming you’re trying to access the value from the key?

To do this you need to tell the hubl to output that key’s value like so:

```auto
{% macro demo(param, type) %}
	{% set value = ['"key"','"value"'] %}
	{% set values = {'theKey':'the value'} %}
 {{ values.theKey }}
{% endmacro %}

{{ demo() }}

```

**EDIT:**

Also when defining the key, you do not need quotes. If you must single quotes work.

`{% set values = {'theKey':'the value'} %}`

or

`{% set values = {theKey:'the value'} %}`
