remove simplejson

- remove encoding detection backport, json.loads supports it directly
- use str.translate instead of multiple str.replace
This commit is contained in:
David Lord 2020-04-07 07:00:15 -07:00
parent 024f0d384c
commit c43edfc7c0
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
6 changed files with 27 additions and 113 deletions

View file

@ -284,22 +284,9 @@ JSON Support
.. module:: flask.json
Flask uses ``simplejson`` for the JSON implementation. Since simplejson
is provided by both the standard library as well as extension, Flask will
try simplejson first and then fall back to the stdlib json module. On top
of that it will delegate access to the current application's JSON encoders
and decoders for easier customization.
So for starters instead of doing::
try:
import simplejson as json
except ImportError:
import json
You can instead just do this::
from flask import json
Flask uses the built-in :mod:`json` module for the JSON implementation.
It will delegate access to the current application's JSON encoders and
decoders for easier customization.
For usage examples, read the :mod:`json` documentation in the standard
library. The following extensions are by default applied to the stdlib's

View file

@ -39,16 +39,12 @@ These distributions will not be installed automatically. Flask will detect and
use them if you install them.
* `Blinker`_ provides support for :doc:`signals`.
* `SimpleJSON`_ is a fast JSON implementation that is compatible with
Python's ``json`` module. It is preferred for JSON operations if it is
installed.
* `python-dotenv`_ enables support for :ref:`dotenv` when running ``flask``
commands.
* `Watchdog`_ provides a faster, more efficient reloader for the development
server.
.. _Blinker: https://pythonhosted.org/blinker/
.. _SimpleJSON: https://simplejson.readthedocs.io/
.. _python-dotenv: https://github.com/theskumar/python-dotenv#readme
.. _watchdog: https://pythonhosted.org/watchdog/