Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
gh-134150: Clarify distinction between JSON and Python objects#134154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -18,12 +18,17 @@ is a lightweight data interchange format inspired by | ||
`JavaScript <https://en.wikipedia.org/wiki/JavaScript>`_ object literal syntax | ||
(although it is not a strict subset of JavaScript [#rfc-errata]_ ). | ||
.. note:: | ||
The term "object" in the context of JSON processing in Python can be | ||
ambiguous. All values in Python are objects. In JSON, an object refers to | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Glossary link to Python object? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. In this case, I don't think a glossary link will help here. The reader in this case will know what a Python object is. | ||
any data wrapped in curly braces, similar to a Python dictionary. | ||
.. warning:: | ||
Be cautious when parsing JSON data from untrusted sources. A malicious | ||
JSON string may cause the decoder to consume considerable CPU and memory | ||
resources. Limiting the size of data to be parsed is recommended. | ||
This module exposes an API familiar to users of the standard library | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Again unrelated, please revert and do not make a mess of this pr. though it should be changed to
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more.
@StanFromIreland Please be aware that this is a first-time contributor. Let's try to be more constructive by pointing to thedevguide. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I think "This module" make a better sentence anyway. | ||
:mod:`marshal` and :mod:`pickle` modules. | ||
Encoding basic Python object hierarchies:: | ||
@@ -60,7 +65,7 @@ Pretty printing:: | ||
"6": 7 | ||
} | ||
Customizing JSON object encoding:: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Ditto There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Again, I think this is a better word, and we don't want to make a separate PR for it, it would be too much churn. | ||
>>> import json | ||
>>> def custom_json(obj): | ||
@@ -83,7 +88,7 @@ Decoding JSON:: | ||
>>> json.load(io) | ||
['streaming API'] | ||
Customizing JSON object decoding:: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Ditto | ||
>>> import json | ||
>>> def as_complex(dct): | ||
@@ -279,7 +284,7 @@ Basic Usage | ||
:param object_hook: | ||
If set, a function that is called with the result of | ||
anyJSONobject literal decoded (a :class:`dict`). | ||
The return value of this function will be used | ||
instead of the :class:`dict`. | ||
This feature can be used to implement custom decoders, | ||
@@ -289,7 +294,7 @@ Basic Usage | ||
:param object_pairs_hook: | ||
If set, a function that is called with the result of | ||
anyJSONobject literal decoded with an ordered list of pairs. | ||
The return value of this function will be used | ||
instead of the :class:`dict`. | ||
This feature can be used to implement custom decoders. | ||
Uh oh!
There was an error while loading.Please reload this page.