[Python-ideas] Serializable method

Masklinn masklinn at masklinn.net
Sat Mar 10 00:07:36 CET 2012


On 2012-03-09, at 23:58 , Jim Rollenhagen wrote:
> This idea was actually started because we were talking about how not all objects/types are JSON-serializable. The example at hand was the bytes type. 

Technically, all object types are JSON-serializable since you can plug
custom encoding schemes in.

Of course, practically few types/libraries provide a `JSONEncoder` and
an object hook so you'll have to build your own if you want to serialize
and deserialize non-core types.

On the other hand, since I'm not sure there's any community standard for
the JSON serialization of e.g. a datetime, it's probably for the best
that providing that is your job, because the library would very likely
provide something you don't want or can't work with.




More information about the Python-ideas mailing list