title: How to access nested JSON with Jinja?
body: <p>I'm learning Jinja for building a simple website. How do I access values of nested JSON in the Jinja syntax?</p>
  <p><strong>Example:</strong> How do I only access the <code>&quot;Education&quot;</code> key in the JSON below to populate the HTML snippet?</p>
  <p><strong>JSON snippet</strong></p>
  <pre><code>{
      &quot;Education&quot;: [
          {
              &quot;SchoolType&quot;: &quot;University&quot;,
              &quot;School&quot;: &quot;State University&quot;,
              &quot;SchoolURL&quot;: &quot;https://admission.edu&quot;,
              &quot;StartMonth&quot;: 9,
              &quot;StartYear&quot;: 2019,
              &quot;EndMonth&quot;: 5,
              &quot;EndYear&quot;: 2022,
              &quot;City&quot;: &quot;Test&quot;,
              &quot;State&quot;: &quot;WA&quot;,
              &quot;Attainment&quot;: &quot;Bachelor's Degree&quot;,
              &quot;Accolades&quot;: [
                  {
                      &quot;AccoladeType&quot;: &quot;Major&quot;,
                      &quot;Accolade&quot;: &quot;Test Communications&quot;
                  }
              ]
          },
          {
              &quot;SchoolType&quot;: &quot;Junior College&quot;,
              &quot;School&quot;: &quot;Pierce College&quot;,
              &quot;SchoolURL&quot;: &quot;https://www.pierce.edu/&quot;,
              &quot;StartMonth&quot;: 9,
              &quot;StartYear&quot;: 2017,
              &quot;EndMonth&quot;: 6,
              &quot;EndYear&quot;: 2019,
              &quot;City&quot;: &quot;Lakewood&quot;,
              &quot;State&quot;: &quot;WA&quot;,
              &quot;Attainment&quot;: &quot;Diploma&quot;,
              &quot;Accolades&quot;: [
              ]
          }
      ],
      &quot;Employers&quot;: [
          {
              &quot;EmploymentType&quot;: &quot;Food Service&quot;,
              &quot;Employer&quot;: &quot;Test Brew&quot;,
              &quot;EmployerURL&quot;: &quot;&quot;,
              &quot;StartMonth&quot;: 9,
              &quot;StartYear&quot;: 2020,
              &quot;EndMonth&quot;: null,
              &quot;EndYear&quot;: null,
              &quot;City&quot;: &quot;Olympia&quot;,
              &quot;State&quot;: &quot;WA&quot;,
              &quot;PositionsHeld&quot;: [
                  {&quot;Position&quot;: &quot;Barista&quot;}
              ]
          },
          {
              &quot;EmploymentType&quot;: &quot;Food Service&quot;,
              &quot;Employer&quot;: &quot;The Steakhouse&quot;,
              &quot;EmployerURL&quot;: &quot;https://www.steakmill.com/&quot;,
              &quot;StartMonth&quot;: 7,
              &quot;StartYear&quot;: 2019,
              &quot;EndMonth&quot;: 1,
              &quot;EndYear&quot;: 2020,
              &quot;City&quot;: &quot;Milton&quot;,
              &quot;State&quot;: &quot;WA&quot;,
              &quot;PositionsHeld&quot;: [
                  {&quot;Position&quot;: &quot;Busser&quot;},
                  {&quot;Position&quot;: &quot;Dishwasher&quot;}
              ]
          }
      ]
  }
  
  </code></pre>
  <p><strong>HTML snippet w/ Jinja</strong></p>
  <pre><code>{% for d in data %}
  
  &lt;section class=&quot;blocks&quot;&gt;
            
    &lt;div class=&quot;date&quot;&gt;
      &lt;span&gt;{{ d.StartMonth }}/{{ d.StartYear }}&lt;/span&gt;
      &lt;span&gt;{{ d.EndMonth }}/{{ d.EndYear }}&lt;/span&gt;
    &lt;/div&gt;
            
    &lt;div class=&quot;decorator&quot;&gt;&lt;/div&gt;
            
    &lt;div class=&quot;details&quot;&gt;
              
      &lt;header&gt;
        &lt;h3&gt;{{ d.Attainment }}&lt;/h3&gt;
        &lt;span class=&quot;place&quot;&gt;&lt;a href={{ d.SchoolURL }}&gt;{{ d.School }}&lt;/a&gt;&lt;/span&gt;
       &lt;span class=&quot;location&quot;&gt;{{ d.City }}, {{ d.State }}&lt;/span&gt;
      &lt;/header&gt;
              
    &lt;/div&gt;
    
  &lt;/section&gt;
  
  {% endfor %}
  </code></pre>
  <p><strong>Tried (with various errors)</strong></p>
  <ul>
  <li>Nested <code>for</code></li>
  </ul>
  <pre><code>{% for d in data %}
      {% for e in d[Education] %}
      &lt;code shown above&gt;
      {% end for %}
  {% end for %}
  </code></pre>
  <ul>
  <li><code>d.StartMonth</code></li>
  <li><code>d[Education].StartMonth</code></li>
  <li><code>d[Education][StartMonth]</code></li>
  </ul>