Utilities for serializing content.
- class DjbletsJSONEncoder(strip_datetime_ms=True, *args, **kwargs)¶
A JSON encoder that supports lazy strings, datetimes, and other objects.
This is a specialization of
DjangoJSONEncoderthe does the following:
Evaluates strings translated with
gettext_lazy()to real strings.
Removes the milliseconds and microseconds from
strip_datetime_ms=Falsewhen constructing the encoder). This is to help keep timestamps from appearing too new when compared against data coming from a MySQL database (which historically, and by default, chops off milliseconds).
to_jsonmethod via that method.
- __init__(strip_datetime_ms=True, *args, **kwargs)¶
Initialize the encoder.