Commit Graph

147 Commits

Author SHA1 Message Date
Miss Islington (bot) 863c7e0f9f [3.15] gh-149056: Properly pass array_hook in json.load() to json.loads() (GH-149057) (GH-150591)
(cherry picked from commit f87d9605d3)

Co-authored-by: Thomas Kowalski <thom.kowa@gmail.com>
2026-05-29 21:30:50 +00:00
Miss Islington (bot) 03244b9f04 [3.15] gh-150285: Fix too long docstrings in some Python modules (GH-150366) (GH-150375)
(cherry picked from commit 01c6d3d76b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2026-05-25 11:19:36 +03:00
Miss Islington (bot) 4277df2421 [3.15] gh-146061: Clarify indent=None in json docs (GH-146095) (GH-149667)
(cherry picked from commit 833dae7c1f)

Co-authored-by: Jonathan Dung <jonathandung@yahoo.com>
2026-05-11 11:44:11 +00:00
Hugo van Kemenade ef6f0635ce gh-142389: Add backticks to stdlib argparse help to display in colour (#149384)
Co-authored-by: Savannah Ostrowski <savannah@python.org>
2026-05-04 22:23:18 +00:00
Hugo van Kemenade 42d645a7e8 gh-132631: Fix "I/O operation on closed file" when parsing JSON Lines file (#132632)
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
2026-04-23 15:27:02 +00:00
Joao S. O. Bueno d0061d50b0 gh-146440: Add array_hook parameter to JSON decoders (#146441)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-27 11:10:48 +00:00
Victor Stinner 349639cfa4 gh-141510: Use frozendict in the stdlib (#144909)
Co-authored-by: Donghee Na <donghee.na@python.org>
2026-03-06 10:25:09 +01:00
Victor Stinner 7b0bd9eb91 gh-141510, PEP 814: Add frozendict support to json (#144903) 2026-02-21 12:22:47 +01:00
Brandt Bucher 4cfa695c95 GH-141686: Break cycles created by JSONEncoder.iterencode (GH-141687) 2025-11-18 09:51:18 -08:00
Serhiy Storchaka 7e90bac3cc gh-140793: Improve documentatation and tests for the ensure_ascii option in the json module (GH-140906)
* Document that ensure_ascii=True forces escaping not only non-ASCII, but also
  non-printable characters (the only affected ASCII character is U+007F).
* Ensure that the help output for the json module does not exceed 80
  columns (except one long line in an example and generated lines).
* Add more tests.
2025-11-08 12:07:27 +02:00
Hugo van Kemenade 872eafd2b0 gh-76007: Deprecate __version__ attribute (#138675)
Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-09-29 12:03:23 +03:00
yihong 531fc3a7a3 gh-138019: improve help message for json.tool (#138037) 2025-08-22 08:44:25 +00:00
Roei Ben Artzi ec12559eba gh-131884: Fix incorrect formatting in json.dumps() when using indent and skipkeys=True (GH-132200) 2025-06-03 10:40:25 +03:00
Łukasz Langa f610bbdf74 gh-133346: Make theming support in _colorize extensible (GH-133347)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-05-05 23:45:25 +02:00
Hugo van Kemenade 4ac916ae33 gh-130645: Add color to stdlib argparse CLIs (gh-133380) 2025-05-05 19:46:46 +02:00
Tomas R. 71da68d588 gh-131952: Add colour to the `json` module CLI (#132126)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-04-19 18:11:21 +00:00
Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి) 403886c28d gh-132021: Add bool type to the list of allowed JSON key types (#132048)
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
2025-04-08 11:25:46 +03:00
Nice Zombies df751363e3 gh-125660: Reject invalid unicode escapes for Python implementation of JSON decoder (GH-125683) 2024-10-18 15:29:47 +03:00
Nice Zombies d358425e69 gh-125682: Reject non-ASCII digits in the Python implementation of JSON decoder (GH-125687) 2024-10-18 15:26:29 +03:00
Serhiy Storchaka 7d2c39752f gh-91818: Use default program name in the CLI of many modules (GH-124867)
As argparse now detects by default when the code was run as a module.

This leads to using the actual executable name instead of simply "python"
to display in the usage message ("usage: python -m ...").
2024-10-10 00:20:53 +03:00
Trey Hunner 906b796af8 gh-122873: Allow "python -m json" to work (#122884)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
2024-08-13 17:09:38 +01:00
Serhiy Storchaka e6b25e9a09 gh-122163: Add notes for JSON serialization errors (GH-122165)
This allows to identify the source of the error.
2024-07-23 20:02:54 +03:00
Pieter Eendebak 05adfbba2a gh-95382: Improve performance of json encoder with indent (GH-118105) 2024-05-06 11:04:39 +03:00
Jan Max Meyer 647053fed1 doc: Use super() in subclassed JSONEncoder examples (GH-115565)
Replace calls to `json.JSONEncoder.default(self, obj)`
by `super().default(obj)` within the examples of the documentation.
2024-02-28 14:54:12 +01:00
Serhiy Storchaka b3d2427f22 gh-58032: Do not use argparse.FileType in module CLIs and scripts (GH-113649)
Open and close files manually. It prevents from leaking files,
preliminary creation of output files, and accidental closing of stdin
and stdout.
2024-01-10 15:07:19 +02:00
Carson Radtke cfa25fe3e3 gh-113149: Improve error message when JSON has trailing comma (GH-113227) 2023-12-17 20:52:26 +02:00
Łukasz Langa d3af83b934 Revert "GH-96145: Add AttrDict to JSON module for use with object_hook (#96146)" (#105948)
This reverts commit 1f0eafa844.
2023-06-26 20:35:53 +02:00
Serhiy Storchaka db39050396 gh-96959: Update HTTP links which are redirected to HTTPS (GH-96961) 2022-09-24 14:38:53 +03:00
Raymond Hettinger 1f0eafa844 GH-96145: Add AttrDict to JSON module for use with object_hook (#96146) 2022-08-23 16:22:00 -05:00
Nikita Sobolev 0cbdd21311 bpo-46565: del loop vars that are leaking into module namespaces (GH-30993) 2022-02-03 11:20:08 +02:00
James Gerity 8db06528ca bpo-46001: Change OverflowError to RecursionError in JSON library docstrings (GH-29943) 2021-12-07 11:58:40 +02:00
Chris Wesseling 815dad42d5 bpo-45644: Make json.tool read infile before writing to outfile (GH-29273)
so that

$ python -m json.tool foo.json foo.json

doesn't result in an empty foo.json.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-11-06 18:11:35 +01:00
Dong-hee Na 700cb58730 bpo-39828: Fix json.tool to catch BrokenPipeError (GH-18779) 2020-03-10 08:41:44 +01:00
Inada Naoki 5492bfcefe bpo-39377: json: Remove the encoding option. (GH-18075) 2020-01-20 13:54:00 +09:00
Daniel Himmelstein 15fb7fa881 bpo-29636: json.tool: Add document for indentation options. (GH-17482)
And updated test to use subprocess.run
2019-12-07 23:14:40 +09:00
wim glenn efefe25443 bpo-27413: json.tool: Add --no-ensure-ascii option. (GH-17472) 2019-12-06 15:44:01 +09:00
Inada Naoki 808769f3a4 bpo-33684: json.tool: Use utf-8 for infile and outfile. (GH-17460) 2019-12-04 18:39:31 +09:00
Daniel Himmelstein 03257949bc bpo-29636: Add --(no-)indent arguments to json.tool (GH-345) 2019-12-04 15:15:19 +09:00
Hervé Beraud 4d45a3b110 json.tool: use stdin and stdout in default cmdlne arguments (GH-11992)
Argparse can handle default value as stdin and stdout for parameters
as file type (infile, outfile).
2019-05-14 18:52:42 +02:00
Serhiy Storchaka 96aeaec647 bpo-36793: Remove unneeded __str__ definitions. (GH-13081)
Classes that define __str__ the same as __repr__ can
just inherit it from object.
2019-05-06 22:29:40 +03:00
Matthias Bussonnier a8abe097c1 bpo-33461: emit DeprecationWarning when json.loads(encoding=...) is used (GH-6762) 2019-04-09 16:17:25 +09:00
HongWeipeng f194479949 bpo-31553: add --json-lines option to json.tool (#10051)
* add jsonlines option to json.tool

* code review

* fix:avoid read infile after it close

* improve doc in whatsnew 3.8
2018-11-07 12:09:32 +02:00
INADA Naoki e25399b40c bpo-23493: json: Change sort_keys in Python encoder same to C (GH-8131)
Stop using key=lambda.  This behavior is same to C version encoder.
2018-07-07 08:55:03 +09:00
Serhiy Storchaka ae00fb1d4f bpo-30877: Fix clearing a cache in the the JSON decoder. (GH-7048) 2018-05-22 14:55:07 +03:00
INADA Naoki 629338f140 bpo-32360: Remove object_pairs_hook=OrderedDict examples (GH-5001) 2018-04-03 12:39:47 +09:00
INADA Naoki 2812d3d992 bpo-32360: Remove OrderedDict usage from json.tool (GH-5315)
`object_pairs_hook=OrderedDict` idiom is deprecated.
2018-01-25 19:52:58 +09:00
Serhiy Storchaka cfa797c068 bpo-24641: Improved error message for JSON unserializible keys. (#4364)
Also updated an example for default() in the module docstring.
Removed quotes around type name in other error messages.
2017-11-25 17:38:20 +02:00
dong-jy 76c567ee27 Fix trivial typo in json module docstring (GH-2274) 2017-06-20 13:07:20 -07:00
Serhiy Storchaka 5affd23e6f bpo-29762: More use "raise from None". (#569)
This hides unwanted implementation details from tracebacks.
2017-04-05 09:37:24 +03:00
Serhiy Storchaka 58d3e54556 Fixed the documentation of parse_constant argument in json.load().
parse_constant doesn't get called on 'null', 'true', 'false' since 3.1/2.7.
2016-11-12 22:48:33 +02:00