having Key Error while printing json data
<p><strong>python 3.5.1</strong></p>

<p>hi i have following json and python code and i want to print json data but it has an error that says:</p>

<blockquote>
  <blockquote>
    <p>Key Error : 'A'</p>
  </blockquote>
</blockquote>

<p><strong>python</strong></p>

<pre><code>data = json.load(...)
for item in data['x']
    print (item['A'])
</code></pre>

<p><strong>json</strong></p>

<pre><code>{"x":[
    {"A":"B"},
    {"C":"D"}
]}
</code></pre>

<p>whats my problem?</p>

<p>To print the values in each dictionary (with <em>unmatching</em> keys), use the <code>values</code> method of the dictionary:</p>

<pre><code>data = json.load(...)
for item in data['x']:
    print(item.values())
</code></pre>

python json