title: Printing/Parsing JSON object from RDF query result
body: <p>I'm trying to parse a result from an SPARQL query from Sesame.
  I found sample code, the relevant part below, and I'm showing my result below. </p>
  
  <pre><code>(response, content) = httplib2.Http().request(endpoint, 'POST', urllib.urlencode(params), headers=headers)
  
  print "Response %s" % response.status
  results = json.loads(content)
  print "\n".join([result['type']['value'] for result in results['results']['bindings']])
  
  {
  
     "head": {
  
         "vars": [ "costar", "movie" ]
  
     },
  
     "results": {
  
         "bindings": [
  
             {
  
                 "costar": { "type": "uri", "value": "http:\/\/rdf.freebase.com\/ns\/en.connie_nielsen" },
  
                 "movie": { "type": "uri", "value": "http:\/\/rdf.freebase.com\/ns\/en.basic_2003" }
  
             },
  
             {
  
                 "costar": { "type": "uri", "value": "http:\/\/rdf.freebase.com\/ns\/en.timothy_daly" },
  
                 "movie": { "type": "uri", "value": "http:\/\/rdf.freebase.com\/ns\/en.basic_2003" }
  
             },
  
  
        ]
  
     }
  
  }     
  </code></pre>
  
  <p>But I get this error: </p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\Software\rdflib\movieSparqlQuery.py", line 45, in &lt;module&gt;
      print "\n".join([result['type']['value'] for result in results['results']['b
  indings']])
  KeyError: 'type'
  Press any key to continue . . .
  </code></pre>
  
  <p>How can I change the "print" statement? </p>
  
  <p>What I want to see is something like the costar and movie name on the same line:</p>
  
  <pre><code>http://rdf.freebase.com/ns/en.connie_nielsen  http://rdf.freebase.com/ns/en.basic_2003
  </code></pre>
  
  <p>Later, I'll strip off the namespaces. </p>
  
  <p>Thanks!</p>