title: Serializing mongoengine objects into JSON
body: <p>Here is a example of simple REST API built on Flask with flask-restful and mongoengine:</p>
  
  <pre><code>from flask import Flask, jsonify
  from flask_restful import Resource, Api
  from flask_mongoengine import MongoEngine
  
  app = Flask(__name__)
  app.config['MONGODB_SETTINGS'] = {
      'db': 'persons',
      'host': 'localhost',
      'port': 27017
  }
  api = Api(app)
  db = MongoEngine(app)
  
  class Person(db.Document):
      firstname = db.StringField(required=True)
      lastname = db.StringField(required=True)
  
  class PersonList(Resource):
      def get(self):
          return jsonify(Person.objects)
  
  api.add_resource(PersonList, '/persons')
  
  if __name__ == '__main__':
      app.run(debug=True)
  </code></pre>
  
  <p>Do I really have to call flask.jsonify() everytime (in each method that deals with db) to serialize mongoengine objects into JSON?</p>