<p>As @mats-mikkel-rummelhoff suggested, that data type is an array. So I was able to get the desired value by using:</p>

<pre><code>'img' : node['media:content'][1]['@url']
</code></pre>

<p>Thanks, Mats.</p>

CC BY-SA 4.0
2018-09-12T06:31:33.860Z
2018-09-12T07:43:50.327Z
2018-09-12T07:43:50.327Z
Marcus Scheller
<p>Probably pure twig:</p>

<p>I am building an array from nodes taken from a RSS-feed where one of the keys contains a colon which of course breaks everything. Like so:</p>

<p>Node in feed: </p>

<pre><code>&lt;media:thumbnail url="stuff I like to get." /&gt;
</code></pre>

<p>My twig:</p>

<pre><code>{% for node in feed %}
        {% set latestArticles = latestArticles|merge([{
                'timestamp': node.pubDate|atom,
                'title': node.title,
                'uri': node.link,
                'description': node.description,
                'thumbnail' : node.media:thumbnail,
            }]) %}
        {% endif %}
    {% endfor %}
</code></pre>

<p>So how do I get <code>media:thumbnail</code>?</p>

<p>I have tried different things but without luck.</p>

CC BY-SA 4.0
2018-09-10T05:17:01.593Z
Have you tried _brackets notation_, i.e. `node['media:thumbnail']`?
Mats Mikkel Rummelhoff
CC BY-SA 4.0
2018-09-10T05:44:57.570Z
Yes, I did. It says:

`Key "media:thumbnail" for array with keys "title, link, pubDate, category, guid, description, dc:creator" does not exist.`
Marcus Scheller
CC BY-SA 4.0
2018-09-10T16:48:05.577Z
That suggests that the structure of the node object isn’t what you think it is. Try enabling devMode and do {{ dump(node) }} to see the object’s contents and structure
Mats Mikkel Rummelhoff
CC BY-SA 4.0
2018-09-10T17:14:44.980Z
Haven’t thought about dump. 

No idea, why. You’re right, it’s an array. So the correct code is: `'img' : node['media:content'][1]['@url']`

Thanks!
Marcus Scheller
CC BY-SA 4.0
2018-09-10T23:32:38.243Z
@MarcusScheller would you mind adding that as an official answer in case it ends up helping someone in the future?
Brad Bell
CC BY-SA 4.0
2018-09-12T06:26:14.813Z
That is the plan.
Marcus Scheller
<templating><array>
Build array from nodes from RSS where keys contain colons
# Build array from nodes from RSS where keys contain colons

(Asked by: username_0 on 2018-09-09)

Probably pure twig:
I am building an array from nodes taken from a RSS-feed where one of the keys contains a colon which of course breaks everything. Like so:
Node in feed: 


My twig:
{% for node in feed %}
        {% set latestArticles = latestArticles|merge([{
                'timestamp': node.pubDate|atom,
                'title': node.title,
                'uri': node.link,
                'description': node.description,
                'thumbnail' : node.media:thumbnail,
            }]) %}
        {% endif %}
    {% endfor %}

So how do I get media:thumbnail?
I have tried different things but without luck.

**Tags:** templating, array
> **Comments:**
> **username_1**: Have you tried _brackets notation_, i.e. `node['media:thumbnail']`?  
> **username_0**: Yes, I did. It says:  `Key "media:thumbnail" for array with keys "title, link, pubDate, category, guid, description, dc:creator" does not exist.`  
> **username_1**: That suggests that the structure of the node object isn’t what you think it is. Try enabling devMode and do {{ dump(node) }} to see the object’s contents and structure  
> **username_0**: Haven’t thought about dump.   No idea, why. You’re right, it’s an array. So the correct code is: `'img' : node['media:content'][1]['@url']`  Thanks!  
> **username_2**: @MarcusScheller would you mind adding that as an official answer in case it ends up helping someone in the future?  
> **username_0**: That is the plan.  

---

## 1 answers

### Answer by username_0 on 2018-09-12. Score: 1 | Accepted answer

As @mats-mikkel-rummelhoff suggested, that data type is an array. So I was able to get the desired value by using:
'img' : node['media:content'][1]['@url']

Thanks, Mats.


---

