@@ -18,12 +18,17 @@ is a lightweight data interchange format inspired by
18
18
`JavaScript <https://en.wikipedia.org/wiki/JavaScript >`_ object literal syntax
19
19
(although it is not a strict subset of JavaScript [#rfc-errata ]_ ).
20
20
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
+
21
26
.. warning ::
22
27
Be cautious when parsing JSON data from untrusted sources. A malicious
23
28
JSON string may cause the decoder to consume considerable CPU and memory
24
29
resources. Limiting the size of data to be parsed is recommended.
25
30
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
27
32
:mod: `marshal ` and :mod: `pickle ` modules.
28
33
29
34
Encoding basic Python object hierarchies::
@@ -60,7 +65,7 @@ Pretty printing::
60
65
"6": 7
61
66
}
62
67
63
- Specializing JSON object encoding::
68
+ Customizing JSON object encoding::
64
69
65
70
>>> import json
66
71
>>> def custom_json(obj):
@@ -83,7 +88,7 @@ Decoding JSON::
83
88
>>> json.load(io)
84
89
['streaming API']
85
90
86
- Specializing JSON object decoding::
91
+ Customizing JSON object decoding::
87
92
88
93
>>> import json
89
94
>>> def as_complex(dct):
@@ -279,7 +284,7 @@ Basic Usage
279
284
280
285
:param object_hook:
281
286
If set, a function that is called with the result of
282
- any object literal decoded (a :class: `dict `).
287
+ any JSON object literal decoded (a :class: `dict `).
283
288
The return value of this function will be used
284
289
instead of the :class: `dict `.
285
290
This feature can be used to implement custom decoders,
@@ -289,7 +294,7 @@ Basic Usage
289
294
290
295
:param object_pairs_hook:
291
296
If set, a function that is called with the result of
292
- any object literal decoded with an ordered list of pairs.
297
+ any JSON object literal decoded with an ordered list of pairs.
293
298
The return value of this function will be used
294
299
instead of the :class: `dict `.
295
300
This feature can be used to implement custom decoders.
0 commit comments