[Python-ideas] Serialization of CSV vs. JSON

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Nov 3 17:43:57 EDT 2018


David Shawley wrote:
> I'm +1 on adding support for serializing datetime.date and
> datetime.datetime *but* I'm -1 on automatically deserializing anything that
> looks like a ISO-8601 in json.load*.  The asymmetry is the only thing that
> kept me from bringing this up previously.

This asymmetry bothers me too. It makes me think that datetime
handling belongs at a different level of abstraction, something
that knows about the structure of the data being serialised or
deserialised.

Java's JSON libraries have a mechanism where you can give it
a class and a lump of JSON and it will figure out from runtime
type information what to do. It seems like we should be able
to do something similar using type annotations.

-- 
Greg


More information about the Python-ideas mailing list