How can I serialize a python list contains datetime.date objects, to a JSON array of javascript Date objects? For example:
lst = [datetime.date(2013, 12, 30), datetime.date(2013, 12, 31)]
print serialize(lst)
# should print "[new Date(2013, 12, 30), new Date(2013, 12, 31)]"
I've tried json.dumps with a custom handler but the handler can only return serializable objects and not the actual JSON syntax.
Dateobjects." You can have a JSON array, or you can have a JavaScript array containingDateobjects. JSON != JavaScript, and JSON doesn't have any concept of dates..isoformat().Datetype is not supported in JSON.Dateobjects and that's something I prefer not to do.new Date(...)in JavaScript, the months range 0-11. In python they are 1-12.