Title: Contradictory sentences in json docs · Issue #146061 · python/cpython · GitHub
Open Graph Title: Contradictory sentences in json docs · Issue #146061 · python/cpython
X Title: Contradictory sentences in json docs · Issue #146061 · python/cpython
Description: Documentation In the json docs, it is said that "the most compact representation" for json is used if None is passed as indent to json.dump (the default behaviour), under the json.dump "Parameters" section. However, under the description...
Open Graph Description: Documentation In the json docs, it is said that "the most compact representation" for json is used if None is passed as indent to json.dump (the default behaviour), under the json.dump "Parameters"...
X Description: Documentation In the json docs, it is said that "the most compact representation" for json is used if None is passed as indent to json.dump (the default behaviour), under the json.dump &q...
Opengraph URL: https://github.com/python/cpython/issues/146061
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Contradictory sentences in json docs","articleBody":"### Documentation\n\nIn the [json docs](https://docs.python.org/3/library/json.html), it is said that \"the most compact representation\" for json is used if `None` is passed as `indent` to `json.dump` (the default behaviour), under the `json.dump` \"Parameters\" section.\n\nHowever, under the description for the `separators` parameter, this is said: \"If [separators is ]None (the default), separators defaults to (', ', ': ') if indent is None, and (',', ': ') otherwise. For the most compact JSON, specify (',', ':') to eliminate whitespace.\" The claim that the default behaviour gives \"the most compact representation\" is thus wrong; `separators=(',', ':')` is actually required as well.\n\nSection concerned ([source](https://github.com/python/cpython/blob/main/Doc/library/json.rst#basic-usage)):\n\n```rst\n :param indent:\n If a positive integer or string, JSON array elements and\n object members will be pretty-printed with that indent level.\n A positive integer indents that many spaces per level;\n a string (such as ``\"\\t\"``) is used to indent each level.\n If zero, negative, or ``\"\"`` (the empty string),\n only newlines are inserted.\n If ``None`` (the default), the most compact representation is used.\n :type indent: int | str | None\n\n :param separators:\n A two-tuple: ``(item_separator, key_separator)``.\n If ``None`` (the default), *separators* defaults to\n ``(', ', ': ')`` if *indent* is ``None``,\n and ``(',', ': ')`` otherwise.\n For the most compact JSON,\n specify ``(',', ':')`` to eliminate whitespace.\n :type separators: tuple | None\n```\n\nI can open a PR if required.\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-146095\n* gh-149667\n* gh-149668\n* gh-149669\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/jonathandung","@type":"Person","name":"jonathandung"},"datePublished":"2026-03-17T14:18:29Z","url":"https://github.com/python/cpython/issues/146061"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3cf28191-1ab2-d8a7-b8c0-daf037053913 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E6C8:1C94F:2B4824E:3779B3C:6B01F7A7 |
| html-safe-nonce | 0c4658bfb83e147083b1a0f7519e8ef61425d3faa8f93a4c4b1d1a49aa9d4dd3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNkM4OjFDOTRGOjJCNDgyNEU6Mzc3OUIzQzo2QjAxRjdBNyIsInZpc2l0b3JfaWQiOiI3OTA5ODU4MTAzMzY4MjE4NTM1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | c6a0aaa1f1bd9f3c630e1d9427f79ad50dee2d79c7be91744f54656171fbb71f |
| hovercard-subject-tag | issue:4088876594 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/146061/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1ae29d12905ceedde3650f19ffce55005b0dcb193ec2c5b4a4f18e21ba2231b7/python/cpython/issues/146061 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1ae29d12905ceedde3650f19ffce55005b0dcb193ec2c5b4a4f18e21ba2231b7/python/cpython/issues/146061 |
| og:image:alt | Documentation In the json docs, it is said that "the most compact representation" for json is used if None is passed as indent to json.dump (the default behaviour), under the json.dump "Parameters"... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jonathandung |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width