Title: JSON does not preserve the order of OrderedDict · Issue #100272 · python/cpython · GitHub
Open Graph Title: JSON does not preserve the order of OrderedDict · Issue #100272 · python/cpython
X Title: JSON does not preserve the order of OrderedDict · Issue #100272 · python/cpython
Description: #95385 caused a regression in JSON serialization of OrderedDict when use the C implementation. >>> import collections, json >>> od = collections.OrderedDict(a=1, b=2) >>> od.move_to_end('a') >>> od OrderedDict([('b', 2), ('a', 1)]) >>> j...
Open Graph Description: #95385 caused a regression in JSON serialization of OrderedDict when use the C implementation. >>> import collections, json >>> od = collections.OrderedDict(a=1, b=2) >>> od.move_to_end('a') >>> od...
X Description: #95385 caused a regression in JSON serialization of OrderedDict when use the C implementation. >>> import collections, json >>> od = collections.OrderedDict(a=1, b=2) >>>...
Opengraph URL: https://github.com/python/cpython/issues/100272
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"JSON does not preserve the order of OrderedDict","articleBody":"#95385 caused a regression in JSON serialization of OrderedDict when use the C implementation.\r\n\r\n```pycon\r\n\u003e\u003e\u003e import collections, json\r\n\u003e\u003e\u003e od = collections.OrderedDict(a=1, b=2)\r\n\u003e\u003e\u003e od.move_to_end('a')\r\n\u003e\u003e\u003e od\r\nOrderedDict([('b', 2), ('a', 1)])\r\n\u003e\u003e\u003e json.dumps(od)\r\n'{\"a\": 1, \"b\": 2}'\r\n```\r\n\r\nWith the pure Python implementation, as well as in older Pythons, you get `'{\"b\": 2, \"a\": 1}'`.\r\n\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-100273\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/serhiy-storchaka","@type":"Person","name":"serhiy-storchaka"},"datePublished":"2022-12-15T16:10:16.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/100272/cpython/issues/100272"}
| 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:996fbbde-3c02-63d1-4313-4a5d9a2a3097 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D3EA:2EA26A:13B7AA2:1BE23CB:69691AC6 |
| html-safe-nonce | 2916e0713350aa2c7041b35c0b47a5ec97d836a76b69c55d467b094a9c649487 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEM0VBOjJFQTI2QToxM0I3QUEyOjFCRTIzQ0I6Njk2OTFBQzYiLCJ2aXNpdG9yX2lkIjoiMTMxMTc3MzQ0MDIwODM0NTc5OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c249184f6782401d63d0c8dcf5f9f042cb06710b65b4cd317596e5cf32e48c4d |
| hovercard-subject-tag | issue:1498705665 |
| 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/100272/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a33b078cb05fcf8a4f237d68eefcf17f1a3cdb5eda58e4b14453f2f3032b1982/python/cpython/issues/100272 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a33b078cb05fcf8a4f237d68eefcf17f1a3cdb5eda58e4b14453f2f3032b1982/python/cpython/issues/100272 |
| og:image:alt | #95385 caused a regression in JSON serialization of OrderedDict when use the C implementation. >>> import collections, json >>> od = collections.OrderedDict(a=1, b=2) >>> od.move_to_end('a') >>> od... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | serhiy-storchaka |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0e60568924309a021b51adabdce15c2a2f285b556f3130d1a2fa2a5bce11c55f |
| 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 | dd206f7ed6207863172be4a783826e86bd2375c3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width