Answers.Body: <pre><code>{% if json %}
  </code></pre>
  
  <p>Replaced with. </p>
  
  <pre><code>{% if asset.kind == 'json' %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-04T18:25:24.767Z
Answers.LastActivityDate: 2017-04-04T19:03:17.230Z
Answers.LastEditDate: 2017-04-04T19:03:17.230Z
Answers.UserDisplayName: treetop55
Body: <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>
  
Tags: <assets>
Title: Get Kind of Asset Field
ThreadText: # 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 %}
  
                      <video width="320" height="240" controls>
                          <source src="{{ entry.mediaVideo.first.getUrl() }}">
                      </video>
  
                  {% 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' %}
  
  ```
  
  
  ---
  
  