Using the same example given in the json262 documentation
>>> import datetime
>>> import json
>>> from json262 import JSON262Encoder
>>> data = {'day': datetime.date(2010, 2, 17)}
>>> data == json.loads(json.dumps(data, cls=JSON262Encoder))
False
>>> json.loads(json.dumps(data, cls=JSON262Encoder))
{u'day': u'2010-02-17'}
When decoded there is no way to distinguish the value of the attribute day as a date. So JSON decoder decodes it as unicode.
To overcome this limitation, tryton project which implements RPC over JSON implements its JSON encoder and decoder.
(Install using pip install trytond)
>>> import datetime
>>> import json
>>> from trytond.protocols.jsonrpc import object_hook, JSONEncoder
>>> data = {'day': datetime.date(2010, 2, 17)}
>>> data == json.loads(json.dumps(data, cls=JSONEncoder), object_hook=object_hook)
True
Tried with javascript too