@@ -39,7 +39,8 @@ def dumps(obj: Any, default=Optional[Callable[Any]]) -> bytes: ...
3939
4040` dumps() ` serializes Python objects to JSON. It natively serializes
4141` str ` , ` dict ` , ` list ` , ` tuple ` , ` int ` , ` float ` , and ` None ` instances. It
42- supports arbitrary types through ` default ` .
42+ supports arbitrary types through ` default ` . It does not serialize
43+ subclasses of supported types natively, but ` default ` may be used.
4344
4445It raises ` JSONEncodeError ` on an unsupported type. This exception message
4546describes the invalid object.
@@ -54,7 +55,8 @@ It raises `JSONEncodeError` if a `dict` has a key of a type other than `str`.
5455It raises ` JSONEncodeError ` if the output of ` default ` recurses to handling by
5556` default ` more than five levels deep.
5657
57- ` JSONEncodeError ` is a subclass of ` TypeError ` .
58+ ` JSONEncodeError ` is a subclass of ` TypeError ` . This is for compatibility
59+ with the standard library.
5860
5961
6062``` python
@@ -97,8 +99,11 @@ def loads(obj: Union[bytes, str]) -> Union[dict, list, int, float, str, None]: .
9799
98100` loads() ` deserializes JSON to Python objects.
99101
100- It raises ` orjson.JSONDecodeError ` if given an invalid type or invalid
101- JSON. This exception is a subclass of ` ValueError ` .
102+ It raises ` JSONDecodeError ` if given an invalid type or invalid
103+ JSON.
104+
105+ ` JSONDecodeError ` is a subclass of ` ValueError ` . This is for
106+ compatibility with the standard library.
102107
103108
104109``` python
0 commit comments