Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbf39dec

Browse files
[3.14]gh-134150: Clarify distinction between JSON and Python objects (GH-134154) (#134166)
gh-134150: Clarify distinction between JSON and Python objects (GH-134154)*gh-134150: Clarify distinction between JSON objects and Python objects in json module docs* Revert change to JSON introduction* Clarify occurrences of "object literal" as JSON(cherry picked from commitfa4e088)Co-authored-by: Micha Albert <micha@2231puppy.tech>
1 parenteaee2ae commitbf39dec

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

‎Doc/library/json.rst

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,17 @@ is a lightweight data interchange format inspired by
1818
`JavaScript<https://en.wikipedia.org/wiki/JavaScript>`_ object literal syntax
1919
(although it is not a strict subset of JavaScript [#rfc-errata]_ ).
2020

21+
..note::
22+
The term "object" in the context of JSON processing in Python can be
23+
ambiguous. All values in Python are objects. In JSON, an object refers to
24+
any data wrapped in curly braces, similar to a Python dictionary.
25+
2126
..warning::
2227
Be cautious when parsing JSON data from untrusted sources. A malicious
2328
JSON string may cause the decoder to consume considerable CPU and memory
2429
resources. Limiting the size of data to be parsed is recommended.
2530

26-
:mod:`json` exposes an API familiar to users of the standard library
31+
This module exposes an API familiar to users of the standard library
2732
:mod:`marshal` and:mod:`pickle` modules.
2833

2934
Encoding basic Python object hierarchies::
@@ -60,7 +65,7 @@ Pretty printing::
6065
"6": 7
6166
}
6267

63-
Specializing JSON object encoding::
68+
Customizing JSON object encoding::
6469

6570
>>> import json
6671
>>> def custom_json(obj):
@@ -83,7 +88,7 @@ Decoding JSON::
8388
>>> json.load(io)
8489
['streaming API']
8590

86-
Specializing JSON object decoding::
91+
Customizing JSON object decoding::
8792

8893
>>> import json
8994
>>> def as_complex(dct):
@@ -279,7 +284,7 @@ Basic Usage
279284

280285
:param object_hook:
281286
If set, a function that is called with the result of
282-
any object literal decoded (a:class:`dict`).
287+
anyJSONobject literal decoded (a:class:`dict`).
283288
The return value of this function will be used
284289
instead of the:class:`dict`.
285290
This feature can be used to implement custom decoders,
@@ -289,7 +294,7 @@ Basic Usage
289294

290295
:param object_pairs_hook:
291296
If set, a function that is called with the result of
292-
any object literal decoded with an ordered list of pairs.
297+
anyJSONobject literal decoded with an ordered list of pairs.
293298
The return value of this function will be used
294299
instead of the:class:`dict`.
295300
This feature can be used to implement custom decoders.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp