Skip to content

[codex] Preserve ordered dict output by default#452

Merged
quinnj merged 1 commit into
masterfrom
codex/fix-ordered-dict-sort-default
Apr 28, 2026
Merged

[codex] Preserve ordered dict output by default#452
quinnj merged 1 commit into
masterfrom
codex/fix-ordered-dict-sort-default

Conversation

@quinnj
Copy link
Copy Markdown
Member

@quinnj quinnj commented Apr 27, 2026

Summary

  • Limit default sort_keys=nothing behavior to plain Dict values.
  • Preserve iteration order for other AbstractDict implementations, including OrderedDict-style containers.
  • Keep explicit sort_keys=true behavior sorting all AbstractDict values.

Root Cause

#442 made the default writer sort every non-JSON.Object AbstractDict. That improved deterministic output for unordered Dict, but it also changed the semantics of ordered dictionary implementations whose iteration order is meaningful.

Validation

  • Reproduced JSON 1.4.0 vs 1.5.0 behavior with OrderedCollections.OrderedDict.
  • Verified this branch restores insertion-order output for OrderedDict while preserving sort_keys=true.
  • Ran julia --startup-file=no --project=. -e 'using Pkg; Pkg.test(; coverage=false)'.

Fixes #447.

Default sort_keys behavior now sorts plain Dict while preserving iteration order for other AbstractDict implementations. Explicit sort_keys=true continues to sort all AbstractDict values.\n\nFixes #447.
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.30%. Comparing base (53df2b3) to head (dc22640).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #452   +/-   ##
=======================================
  Coverage   90.29%   90.30%           
=======================================
  Files           7        7           
  Lines        1391     1392    +1     
=======================================
+ Hits         1256     1257    +1     
  Misses        135      135           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@quinnj quinnj marked this pull request as ready for review April 27, 2026 16:05
@quinnj quinnj merged commit 9959397 into master Apr 28, 2026
11 checks passed
@quinnj quinnj deleted the codex/fix-ordered-dict-sort-default branch April 28, 2026 02:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OrderedDict output changes on 1.4.0 -> 1.5.0

1 participant