Ordered keys + LinkedHashMap by hewerlin · Pull Request #386 · stleary/JSON-java · GitHub
Skip to content

Ordered keys + LinkedHashMap#386

Closed
hewerlin wants to merge 1 commit into
stleary:masterfrom
hewerlin:master
Closed

Ordered keys + LinkedHashMap#386
hewerlin wants to merge 1 commit into
stleary:masterfrom
hewerlin:master

Conversation

@hewerlin

@hewerlin hewerlin commented Dec 2, 2017

Copy link
Copy Markdown

Yes, you have left a comment that you did that on purpose. So you will most likely deny this request.

I just love your JSON implementation! It's so intuitive and performs well.
The only thing that really annoys me is this "random" key order due to the HashMap.
LinkedHashMap stores key in the order they are inserted but still has super fast lookup.

JSON is very often also viewed by developers, so the order of the output keys should make sense.
Also, when you read a JSON string and then write it back to JSON again, the output is not mixed up but the same (not taking whitespace and differences in \u... character encoding into account).

If you deny the pull request, that will be fine.
I prefer the version with LinkedHashMap.

@migueltt

migueltt commented Dec 3, 2017

Copy link
Copy Markdown
Contributor

@johnjaylward

Copy link
Copy Markdown
Contributor

There is no way we can accept this pr as is. It's been provided by many people nearly identically over the years.

The best way to get this accepted would be to make a very thoughtful change like mentioned by @migueltt. Doing a thorough change while maintaining the current unordered logic as default would be the best way to get it accepted.

@stleary

stleary commented Dec 3, 2017

Copy link
Copy Markdown
Owner

@stleary stleary closed this Dec 3, 2017
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.

4 participants