title: Why am I seeing "TypeError: string indices must be integers"?
body: <p>I'm playing with both learning Python and am trying to get GitHub issues into a readable form. Using the advice on <em><a href="https://stackoverflow.com/questions/1871524/convert-from-json-to-csv-using-python">How can I convert JSON to CSV?</a></em>, I came up with this:</p>
  <pre><code>import json
  import csv
  
  f = open('issues.json')
  data = json.load(f)
  f.close()
  
  f = open(&quot;issues.csv&quot;, &quot;wb+&quot;)
  csv_file = csv.writer(f)
  
  csv_file.writerow([&quot;gravatar_id&quot;, &quot;position&quot;, &quot;number&quot;, &quot;votes&quot;, &quot;created_at&quot;, &quot;comments&quot;, &quot;body&quot;, &quot;title&quot;, &quot;updated_at&quot;, &quot;html_url&quot;, &quot;user&quot;, &quot;labels&quot;, &quot;state&quot;])
  
  for item in data:
      csv_file.writerow([item[&quot;gravatar_id&quot;], item[&quot;position&quot;], item[&quot;number&quot;], item[&quot;votes&quot;], item[&quot;created_at&quot;], item[&quot;comments&quot;], item[&quot;body&quot;], item[&quot;title&quot;], item[&quot;updated_at&quot;], item[&quot;html_url&quot;], item[&quot;user&quot;], item[&quot;labels&quot;], item[&quot;state&quot;]])
  </code></pre>
  <p>Where &quot;issues.json&quot; is the JSON file containing my GitHub issues. When I try to run that, I get</p>
  <pre class="lang-none prettyprint-override"><code>File &quot;foo.py&quot;, line 14, in &lt;module&gt;
  csv_file.writerow([item[&quot;gravatar_id&quot;], item[&quot;position&quot;], item[&quot;number&quot;], item[&quot;votes&quot;], item[&quot;created_at&quot;], item[&quot;comments&quot;], item[&quot;body&quot;], item[&quot;title&quot;], item[&quot;updated_at&quot;], item[&quot;html_url&quot;], item[&quot;user&quot;], item[&quot;labels&quot;], item[&quot;state&quot;]])
  
  TypeError: string indices must be integers
  </code></pre>
  <p>What am I missing here? Which are the &quot;string indices&quot;? I'm sure that once I get this working I'll have more issues, but for now, I'd just love for this to work!</p>
  <p>When I tweak the <code>for</code> statement to simply</p>
  <pre><code>for item in data:
      print item
  </code></pre>
  <p>what I get is ... &quot;issues&quot; -- so I'm doing something more basic wrong. Here's a bit of my JSON content:</p>
  <pre><code>{&quot;issues&quot;: [{&quot;gravatar_id&quot;: &quot;44230311a3dcd684b6c5f81bf2ec9f60&quot;, &quot;position&quot;: 2.0, &quot;number&quot;: 263, &quot;votes&quot;: 0, &quot;created_at&quot;: &quot;2010/09/17 16:06:50 -0700&quot;, &quot;comments&quot;: 11, &quot;body&quot;: &quot;Add missing paging (Older&gt;&gt;) links...
  </code></pre>
  <p>when I print <code>data</code>, it looks like it is getting munged really oddly:</p>
  <pre><code>{u'issues': [{u'body': u'Add missing paging (Older&gt;&gt;) lin...
  </code></pre>