I am writing an API in Flask with mongoengine. In my 'search' endpoint, the API receives an 'id' and retrieves all the objects from database against that id. But when I try to return those objects in json form like this:
return [redemp.to_json for redemp in redemps]
I get the error saying "TypeError: 'list' object is not callable"
What's wrong here?