title: Access attributes in JSON file with python and filter items by attribute
body: <p>I have a json file as an input:</p>
  <pre><code>    &quot;Module1&quot;: {
        &quot;Description&quot;: &quot;&quot;,
        &quot;Layer&quot;: &quot;1&quot;,
        &quot;SourceDir&quot;: &quot;path&quot;
        &quot;Attributes&quot;: {
        &quot;some&quot;,
        },
        &quot;Vendor&quot;: &quot;comp&quot;
        },
      &quot;Module2&quot;: {
        &quot;Description&quot;: &quot;&quot;,
        &quot;Layer&quot;: &quot;2&quot;,
        &quot;SourceDir&quot;: &quot;path&quot;
        &quot;Attributes&quot;: {
        &quot;some&quot;,
        },
        &quot;Vendor&quot;: &quot;&quot;
        },
      
      &quot;Module3&quot;: {
        &quot;Description&quot;: &quot;&quot;,
        &quot;Layer&quot;: &quot;3&quot;,
        &quot;SourceDir&quot;: &quot;path&quot;
        &quot;Attributes&quot;: {
        &quot;some&quot;,
        },
        &quot;Vendor&quot;: &quot;&quot;
        },
      
      &quot;Module1&quot;: 4
        &quot;Description&quot;: &quot;&quot;,
        &quot;Layer&quot;: &quot;4&quot;,
        &quot;SourceDir&quot;: &quot;path&quot;
        &quot;Attributes&quot;: {
        &quot;some&quot;,
        },
        &quot;Vendor&quot;: &quot;comp&quot;
        },
  </code></pre>
  <p>I am trying to extract all modules (their names) if &quot;Vendor&quot; matches to some criteria, in this case all of the modules with &quot;Vendor&quot;: &quot;comp&quot; should be printed together with its source dir (Module1, Module4).</p>
  <p>My code is:</p>
  <pre><code>import json
  for k in swc_list.keys():
    if swc_list[k]['Vendor'] == 'comp':
      list_components.append(k)
      sourceDirList.append(swc_list[k]['SourceDir'])
  </code></pre>
  <p>I keep getting error:
  keyError x</p>