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
json encoding of a map - order of members in an object #6244
Labels
Comments
IMO you've get the meaning of the word "unordered", as used in the referenced RFC, wrong. The 'unordered' property of (a Javascript) object simply means that the below two JSONs represent same object _values_: {"A": 1, "B": 2} and {"B": 2, "A": 1} IOW, proper interoperability IMO _must not_ depend on the order of the name/value pairs in the JSON representation. |
@0xj... The honourable Douglas Crockford for sure could have been more precise. Assuming the order of your objects members is preserved - this is all you need to have your top contributors of this week. var topContributorsThisWeek = { "xxx@bar.com" : "For doing this", "aaa@foo.org" : "Did that" } If not, you have to preserve the order in an extra object var topContributorsThisWeek = { "contributors" : { "aaa@foo.org" : "Did that", "xxx@bar.com" : "For doing this" }, "order" : [ "xxx@bar.com", "aaa@foo.org" ] } the "unordered" order of object members is like an implicit list - it is like buy two get one for free ;) Nazdar - Honza |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by janh4lfar:
The text was updated successfully, but these errors were encountered: