steenzout.serialization.json.encoders module

JSON encoders module.

as_date(dat)[source]

Return the RFC3339 UTC string representation of the given date and time.

Parameters:

dat (datetime.date) – the object/type to be serialized.

Raises:

TypeError

when o is not an instance of datetime.date.

Returns:

(str) JSON serializable type for the given object.

as_object(obj)[source]

Return a JSON serializable type for o.

Parameters:

obj (object) – the object to be serialized.

Raises:

AttributeError

when o is not a Python object.

Returns:

JSON serializable type for the given object.

Return type:

(dict)