Skip to content

gh-146440: Add an example for the json array_hook decoder parameter - #154522

Merged
ambv merged 2 commits into
python:mainfrom
fedonman:docs-json-array-hook-example
Oct 23, 2026
Merged

ambv merged 2 commits into
python:mainfrom
fedonman:docs-json-array-hook-example

Conversation

@fedonman

Copy link
Copy Markdown
Contributor

The array_hook parameter added to the JSON decoders in gh-146440 has version notes but no example, while the "Customizing JSON object decoding" section only shows object_hook and parse_float.

This adds two short examples there: one turning every JSON array into a tuple, and one pairing array_hook with object_pairs_hook to get a deeply immutable result, which is the use case the JSONDecoder docstring already describes. Both are marked # doctest: +SKIP, since the parameter needs Python 3.15 or later and the docs are often built with an older interpreter.

While there, it fixes a small wording slip in the array_hook parameter description ("decoded with as a Python list") and a typo ("structute") in the JSONDecoder docstring.

Documentation only, so there is no news entry.

@read-the-docs-community

read-the-docs-community Bot commented Jul 23, 2026 •

Copy link
Copy Markdown

@ambv ambv added needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes skip news labels Oct 23, 2026
@ambv
ambv merged commit 6d6b1ab into python:main Oct 23, 2026
59 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @fedonman for the PR, and @ambv for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Sorry, @fedonman and @ambv, I could not cleanly backport this to 3.14 due to a conflict.

Please backport manually with cherry_picker, see the devguide for more information.

cherry_picker 6d6b1ab4c8a8f3d1c94b3fa94e691cf9a81d2589 3.14

@bedevere-app

bedevere-app Bot commented Oct 23, 2026

Copy link
Copy Markdown

GH-160465 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Oct 23, 2026
ambv pushed a commit that referenced this pull request Oct 23, 2026
…meter (GH-154522) (GH-160465)

(cherry picked from commit 6d6b1ab)

Co-authored-by: Vyron Vasileiadis <hi@fedonman.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants