title: Pymongo/bson: Convert python.cursor.Cursor object to serializable/JSON object
body: <p>New to MongoDb and Python (<code>webapp2</code>). So, I was fetching some data from a <strong>mongodb</strong> database. But I was unable to use <code>json.dumps</code> on the returned data. Here's my code:</p>
  
  <pre><code>exchangedata = db.Stock_Master.find({"Country": "PHILIPPINES"}, {"_id" : 0})        
  self.response.write(json.dumps(exchangedata)) 
  </code></pre>
  
  <p>This throws an error:</p>
  
  <pre><code>TypeError: pymongo.cursor.Cursor object at 0x7fcd51230290 is not JSON serializable
  </code></pre>
  
  <p>The type of <code>exchangedata</code> is <code>pymongo.cursor.Cursor</code>. How can I convert it into a json object? </p>