title: App engine datastore to_dict alternative to serialize ndb.Model to JSON
body: <p>I have a ndb.Model that I want to convert to JSON.</p>
  
  <pre><code>class Users(ndb.Model):
      username = ndb.StringProperty(indexed=True)
      password= ndb.StringProperty(indexed=True)
      created_at = ndb.DateTimeProperty(auto_now_add=True)
  
  user = Users.query(Users.username==username).get()
  rv = json.dumps(user.to_dict()) 
  print(rv)
  </code></pre>
  
  <p>It throws this error: </p>
  
  <pre><code> TypeError: datetime.datetime(2013, 11, 24, 3, 40, 15) is not JSON serializable
  </code></pre>
  
  <p>Most of the solutions here are for db.Model and are fairly outdated.</p>
  
  <p>sdk version 1.9.10</p>