Python 2.6 json & encoding of datetime.

D

David Wilson

Hi there,

I've been playing with Python's new json library, and found myself
facing a seemingly simple problem: encoding of datetime objects. Some
'jsonlib' that I was using previously was unable to do this, and the
new built-in json module shares the same limitation.

A bit of googling around brought me to <http://www.west-wind.com/
WebLog/posts/214731.aspx> which seems to suggest there is no
standardised way of doing it. Indeed, reading the rather sparse JSON
RFC makes no mention of it.

It appears my only possibility is writing little helper functions to
convert my datetimes to/from ISO8601 strings or UNIX timestamps, but
this just feels wrong. Suggestions?

Thanks,


David.
 

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top