Changes between Version 4 and Version 5 of Ticket #35071, comment 12
- Timestamp:
- Jan 1, 2024, 1:56:49 PM (11 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #35071, comment 12
v4 v5 14 14 }}} 15 15 16 We also can't make `encoder` default to `DjangoJSONEncoder` as it elides the original type so you'd be able to serialize uuid, datetimes, etc but not get them back which breaks the principle of least astonishment IMO. `DjangoJSONEncoder` works well for the serialization framework as it is equipped w hich a deserialization schema (model definition) so type information can be restored but `JSONField` are schema less so it's not a good ''default''.16 We also can't make `encoder` default to `DjangoJSONEncoder` as it elides the original type so you'd be able to serialize uuid, datetimes, etc but not get them back which breaks the principle of least astonishment IMO. `DjangoJSONEncoder` works well for the serialization framework as it is equipped with a deserialization schema (model definition) so type information can be restored but `JSONField` are schema less so it's not a good ''default''.