<pre><code>{% if json %}
</code></pre>

<p>Replaced with. </p>

<pre><code>{% if asset.kind == 'json' %}
</code></pre>

CC BY-SA 3.0
2017-04-04T18:25:24.767Z
2017-04-04T19:03:17.230Z
2017-04-04T19:03:17.230Z
treetop55
<p>I have an entry with one asset field and i need to determine if the 'kind' of asset is either 'json' file or 'video' file. Basically I swap my HTML based on the return 'kind'.</p>

<p>Any help is greatly appreciated. Craft CMS beginner.</p>

<pre><code>{% set videoEntries =  craft.entries({ section: 'mediaRoomVideos' }).find %}
{% if videoEntries is not empty %}

    {% for entry in videoEntries %}
        {% set asset = entry.mediaVideo.first() %}

        {% if asset %}

            {% set json = asset.kind('json') %}
                {% if json %}
                    Do Embedded Video
                {% else %}

                    &lt;video width="320" height="240" controls&gt;
                        &lt;source src="{{ entry.mediaVideo.first.getUrl() }}"&gt;
                    &lt;/video&gt;

                {% endif %}
        {% endif %}
    {% endfor %}
{% endif %}
</code></pre>

<assets>
Get Kind of Asset Field
# Get Kind of Asset Field

(Asked by: username_0 on 2017-04-04)

I have an entry with one asset field and i need to determine if the 'kind' of asset is either 'json' file or 'video' file. Basically I swap my HTML based on the return 'kind'.
Any help is greatly appreciated. Craft CMS beginner.
{% set videoEntries =  craft.entries({ section: 'mediaRoomVideos' }).find %}
{% if videoEntries is not empty %}

    {% for entry in videoEntries %}
        {% set asset = entry.mediaVideo.first() %}

        {% if asset %}

            {% set json = asset.kind('json') %}
                {% if json %}
                    Do Embedded Video
                {% else %}

                    
                        
                    

                {% endif %}
        {% endif %}
    {% endfor %}
{% endif %}

**Tags:** assets


---

## 1 answers

### Answer by username_0 on 2017-04-04. Score: 4

{% if json %}

Replaced with. 
{% if asset.kind == 'json' %}


---

