[issue21543] json library fails to serialize objects such as datetime

2014-05-20 Thread R. David Murray
Changes by R. David Murray : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___ ___ Python

[issue21543] json library fails to serialize objects such as datetime

2014-05-20 Thread Dann Ke
Dann Ke added the comment: I was reading the older 2.7 docs and it didn't click that default() was what I wanted. Thank you for clarifying. On Tue, May 20, 2014 at 10:09 AM, akira wrote: > > akira added the comment: > > json module already allows you to customize the serialization: see > *defa

[issue21543] json library fails to serialize objects such as datetime

2014-05-20 Thread akira
akira added the comment: json module already allows you to customize the serialization: see *default* parameter for json.dumps [1] [1] https://docs.python.org/3/library/json.html#json.dump -- nosy: +akira ___ Python tracker

[issue21543] json library fails to serialize objects such as datetime

2014-05-20 Thread Dann Ke
New submission from Dann Ke: I'm using the json library to serialize objects out for web use. Whenever I serialize a datetime or other included python library object (uuid as another example), it fails with TypeError: datetime.datetime(2014, 5, 20, 9, 37, 56, 133627) is not JSON serializable