Method: flask.json.load
Calls: 1, Exceptions: 0, Paths: 1Back
Path 1: 1 calls (1.0)
StringIO (1)
{} (1)
{'name': 'Flask'} (1)
1def load(fp: t.IO[t.AnyStr], **kwargs: t.Any) -> t.Any:
2 """Deserialize data as JSON read from a file.
3
4 If :data:`~flask.current_app` is available, it will use its
5 :meth:`app.json.load() <flask.json.provider.JSONProvider.load>`
6 method, otherwise it will use :func:`json.load`.
7
8 :param fp: A file opened for reading text or UTF-8 bytes.
9 :param kwargs: Arguments passed to the ``load`` implementation.
10
11 .. versionchanged:: 2.3
12 The ``app`` parameter was removed.
13
14 .. versionchanged:: 2.2
15 Calls ``current_app.json.load``, allowing an app to override
16 the behavior.
17
18 .. versionchanged:: 2.2
19 The ``app`` parameter will be removed in Flask 2.3.
20
21 .. versionchanged:: 2.0
22 ``encoding`` will be removed in Flask 2.1. The file must be text
23 mode, or binary mode with UTF-8 bytes.
24 """
25 if current_app:
26 return current_app.json.load(fp, **kwargs)
27
28 return _json.load(fp, **kwargs)