def json_view(library_id):
    entry = db.Library.find_one({'_id': library_id})
    if entry is not None:
        jsond = json.loads(entry.to_json())
        remove_mongo_keys(jsond) #destructive method
        return jsonify({"results" : [jsond] })
    else:
        return jsonify({"results" : "No library entry with ID %s" % str(library_id) })
 def simplified_json(self):
     tm = json.loads(self.to_json())
     remove_mongo_keys(tm)
     tm['_id'] = str(self._id)
     del(tm['lifestages'])
     del(tm['notes'])
     del(tm['keywords'])
     del(tm['geo_keywords'])
     return tm