X Tutup
Skip to content

Retain sort order if object is an instance of SortedMap#91

Closed
uklimaschewski wants to merge 1 commit intostleary:masterfrom
uklimaschewski:master
Closed

Retain sort order if object is an instance of SortedMap#91
uklimaschewski wants to merge 1 commit intostleary:masterfrom
uklimaschewski:master

Conversation

@uklimaschewski
Copy link
Copy Markdown

Retain the original sort order, if converting from a SortedMap instance

@douglascrockford
Copy link
Copy Markdown
Contributor

JSON keys are unordered. If you fix the order, then you may introduce interoperability problems.

@uklimaschewski
Copy link
Copy Markdown
Author

This pull request does not "fix" the order, it retains the order of already sorted maps. It indroduces in no way interoperability problems.

@douglascrockford
Copy link
Copy Markdown
Contributor

If a consumer assumes a particular order, then you have introduced an interoperability hazard. Consumers will only assume such an order if you guarantee such an order.

@uklimaschewski
Copy link
Copy Markdown
Author

If the consumer does not assume a particular order, then it does not matter to him if there is a particular order or not. So there is no interoperability hazard, because this pull request is not the consumer.

@ghost
Copy link
Copy Markdown

ghost commented Feb 24, 2014

I agree with uklimaschewski. Keeping the order does not contradict that the order "may" change.

@douglascrockford
Copy link
Copy Markdown
Contributor

You are free to express that opinion, but the reality is that if there is an observed order, some applications will depend on that order. We saw this is JavaScript, where a strictly compliant implementation may cause some applications to break. I don't want to make that same mistake here.

BGehrels pushed a commit to BGehrels/JSON-java that referenced this pull request Apr 29, 2020
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.

2 participants

X Tutup