You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, in the _compat.py module, if you have simplejson installed, it will use that over the standard built-in json.
This works fine in Python 2, since simplejson is typically faster than the built in json package, and it is more 'correct' in handling JSON.
However, in Python 3, simplejson is slower than the built in json package especially for smaller json payloads, which is probably a typical use case with the requests library. Even though simplejson handles various JSON strings better than the built in JSON, those cases are not typical.
I would like to see a hook that allows a user to opt to use a alternate JSON library so that a user can specify if they want to use rapidjson, ujson, simpleson for the response.json() decoding.
The text was updated successfully, but these errors were encountered:
The 3.0 release of Requests will remove the use of simplejson in favour of the stdlib module. Until that time, however, we cannot safely remove the option to use simplejson, as it would potentially represent a subtle backward-incompatible dependency change.
I don't really see any reason to allow more general hooking of JSON libraries: ultimately, additional JSON features are not really a thing I think we need to support.
Currently, in the
_compat.py
module, if you have simplejson installed, it will use that over the standard built-in json.This works fine in Python 2, since simplejson is typically faster than the built in json package, and it is more 'correct' in handling JSON.
However, in Python 3, simplejson is slower than the built in json package especially for smaller json payloads, which is probably a typical use case with the requests library. Even though simplejson handles various JSON strings better than the built in JSON, those cases are not typical.
I would like to see a hook that allows a user to opt to use a alternate JSON library so that a user can specify if they want to use rapidjson, ujson, simpleson for the
response.json()
decoding.The text was updated successfully, but these errors were encountered: