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.
Conversation
…objects in json module docs
python-cla-botbot commentedMay 17, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
StanFromIreland left a comment• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Please avoid changes not related to the issue, we generally try to keep pull requests focused to make them easier to review.
This does not fully resolve this issue, there are several places in the docs where it should be clarified e.g. "object" -> "JSON object"
Edit:
I apologize for my review, I was tired and very inconsiderate. Welcome to contributing to cpython, I hope this will be one of many prs:-)
Uh oh!
There was an error while loading.Please reload this page.
(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 comment
The 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 comment
The 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.
.. 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. | ||
:mod:`json` exposes an API familiar to users of the standard library | ||
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 comment
The 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
:mod:`!json`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
do not make a mess of this pr.
@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 comment
The reason will be displayed to describe this comment to others.Learn more.
I think "This module" make a better sentence anyway.
@@ -60,7 +65,7 @@ Pretty printing:: | |||
"6": 7 | |||
} | |||
Specializing JSON object encoding:: | |||
Customizing JSON object encoding:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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 comment
The 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.
@@ -83,7 +88,7 @@ Decoding JSON:: | |||
>>> json.load(io) | |||
['streaming API'] | |||
Specializing JSON object decoding:: | |||
Customizing JSON object decoding:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Ditto
CCing@nedbat, who helped me make these changes at PyCon |
fa4e088
intopython:mainUh oh!
There was an error while loading.Please reload this page.
Thanks@MichaByte for the PR, and@nedbat for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
…ythonGH-134154)*pythongh-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>
GH-134166 is a backport of this pull request to the3.14 branch. |
…ythonGH-134154)*pythongh-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>
GH-134167 is a backport of this pull request to the3.13 branch. |
…GH-134154) (#134167)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>
…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>
Uh oh!
There was an error while loading.Please reload this page.
This PR clears up the ambiguity between JSON objects and Python objects in the
json
module docs by adding a note to inform the reader of the distinction. I also changed two occurrences of the word "specializing" with the word "customizing", since the latter seems to be a better fit for describing what's happening. Let me know if I need to make any changes!Micha
json
module page uses "object" confusingly #134150📚 Documentation preview 📚:https://cpython-previews--134154.org.readthedocs.build/en/134154/library/json.html