Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix JSON output order by using LinkedHashMap/LinkedHashSet #2580

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

seijikohara
Copy link

Proposed Changes

This pull request aims to fix the issue of inconsistent JSON output order by replacing HashMap and HashSet with LinkedHashMap and LinkedHashSet, respectively.

Motivation

Currently, when using HashMap or HashSet, the order of elements in the JSON output is random and changes with each execution. This can lead to readability issues, especially when dealing with large and complex JSON structures.

Implementation

  • Replace all instances of HashMap with LinkedHashMap to preserve the insertion order of key-value pairs in the JSON output.
  • Replace all instances of HashSet with LinkedHashSet to preserve the insertion order of elements in the JSON output.

By using LinkedHashMap and LinkedHashSet, the JSON output order will now follow the order in which elements were inserted, improving readability and consistency.

Please review the changes and let me know if any further modifications are needed.

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.

None yet

1 participant