http://docs.pylonsproject.org/projects/pyramid/en/master/narr/renderers.html#using-the-add-adapter-method-of-a-custom-json-renderer On May 19, 2014 6:55 PM, "Yannick" <[email protected]> wrote:
> Basically what I did I parse the resultset and for each row I convert the > ObjectId to String and it works. > But do you know a more efficient way to handle this situation ? > > On Monday, May 19, 2014 6:40:46 PM UTC-4, Yannick wrote: >> >> Hello mate, >> >> I'm rendering my Python function to JSON. Inside the function I got data >> from mongodb as following: >> >> @view_config(route_name='listdisplay', renderer='json') >> def matchFactStat(request): >> rs = request.db.collection.find() >> return list(playerMatchStatList) >> >> When I do that I have a TypeError: ObjectId() is not JSON serializable >> >> Can you please let me know how to fix this ? >> Thanks >> > -- > You received this message because you are subscribed to the Google Groups > "pylons-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/pylons-discuss. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/pylons-discuss. For more options, visit https://groups.google.com/d/optout.
