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

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

Closed
wants to merge 1 commit into from

Conversation

uklimaschewski
Copy link

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

@douglascrockford
Copy link
Contributor

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

@uklimaschewski
Copy link
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
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
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

ghost commented Feb 24, 2014

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

@douglascrockford
Copy link
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