title: Drupal 8 - how to access field values nested deep inside an array structure
body: <p>I am trying to access values of a content type nested deep into array. This is the actual scenario:</p>
  
  <p>I want to customise the default search result page layout of Drupal 8 with additional field information. To know what fields are available for me to access I used <code>{{ kint(item.value) }}</code>, which shows me this:</p>
  
  <p><a href="https://i.stack.imgur.com/V8fy0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/V8fy0.png" alt="enter image description here"></a></p>
  
  <p>Fields I want to access are nested under <strong><code>#result&gt;node&gt;fields</code></strong> like <code>body</code>, <code>field_category</code> etc.</p>
  
  <p>Is there any way I can access them directly inside my twig template? I was guessing something like <code>{{ item.value['node']['fields']['field_name']} }</code>? but this gave me nothing!</p>
  
  <p>There is every possibility that the way I am thinking is not a suitable method or may be even not a method at all! I am still very new to Drupal.</p>
  
  <p>All I want is to <strong>access desired fields nested deep below inside an array structure</strong>. Is there a kind of thumb rule or syntax to follow? This would be a great help if somebody please explain the process to access a specific element from inside a nested Drupal array.</p>
  
  <p>Note: In order to customise layout I copied <code>item-list.html.twig</code> file from <code>/core/themes/stable/templaes/dataset</code> to my theme's templates folder.</p>
  
  <p><strong>Drupal version: 8.2.3</strong></p>
  
  <p><strong>EDIT</strong>: Template file for search result (<code>item-list.html.twig</code>)</p>
  
  <pre><code>&lt;p class="righteous"&gt;Makes sure the page is being hit!&lt;/p&gt;
  
  {% if context.list_style %}
      {%- set attributes = attributes.addClass('item-list__' ~ context.list_style) %}
  {% endif %}
  {% if items or empty %}
      {%- if title is not empty -%}
          &lt;h3&gt;{{ title }}&lt;/h3&gt;
      {%- endif -%}
  
      {%- if items -%}
          &lt;{{ list_type }}{{ attributes }}&gt;
          {%- for item in items -%}
              &lt;li{{ item.attributes }}&gt;{{ content.body }}&lt;/li&gt;
          {%- endfor -%}
          &lt;/{{ list_type }}&gt;
      {%- else -%}
          {{- empty -}}
      {%- endif -%}
  {%- endif %}
  </code></pre>