Python

Python

JSON is the preferred interchange format for Python users, and Python has support for it in its standard library since version 2.6.

from urllib2 import *
import json
connection = urlopen('http://localhost:8983/solr/collection_name/select?q=cheese&wt=json')
response = json.load(connection)
print response['response']['numFound'], "documents found."

# Print the name of each document.

for document in response['response']['docs']:
  print "  Name =", document['name']

You can even skip the wt=json as it’s the default writer type.