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

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

Merged
nedbat merged 3 commits intopython:mainfromMichaByte:json-docs-fix
May 18, 2025
Merged
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
NextNext commit
gh-134150: Clarify distinction between JSON objects and Python object…
…s in json module docs
  • Loading branch information
@MichaByte
MichaByte committedMay 17, 2025
commit7fedbb664fdc869f2c4d8712dcf575f84ffaba0d
15 changes: 10 additions & 5 deletionsDoc/library/json.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,16 +14,21 @@
`JSON (JavaScript Object Notation) <https://json.org>`_, specified by
:rfc:`7159` (which obsoletes :rfc:`4627`) and by
`ECMA-404 <https://ecma-international.org/publications-and-standards/standards/ecma-404/>`_,
is a lightweight data interchange format inspired by
`JavaScript <https://en.wikipedia.org/wiki/JavaScript>`_ object literal syntax
is a lightweight data interchange format inspired by the object literal syntax
of`JavaScript <https://en.wikipedia.org/wiki/JavaScript>`_
(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
Copy link
Contributor

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?

Copy link
Member

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.

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.

:mod:`json` exposes an API familiar to users of the standard library
This module exposes an API familiar to users of the standard library
Copy link
Contributor

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`

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.

StanFromIreland reacted with thumbs up emoji
Copy link
Member

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.

:mod:`marshal` and :mod:`pickle` modules.

Encoding basic Python object hierarchies::
Expand DownExpand Up@@ -60,7 +65,7 @@ Pretty printing::
"6": 7
}

Specializing JSON object encoding::
Customizing JSON object encoding::
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Ditto

Copy link
Member

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.


>>> import json
>>> def custom_json(obj):
Expand All@@ -83,7 +88,7 @@ Decoding JSON::
>>> json.load(io)
['streaming API']

Specializing JSON object decoding::
Customizing JSON object decoding::
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Ditto


>>> import json
>>> def as_complex(dct):
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp