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

[QUESTION] Does the order of elements in associative array is guaranteed between encode/decode? #36

Closed
tomekit opened this issue Jun 4, 2019 · 3 comments

Comments

@tomekit
Copy link

tomekit commented Jun 4, 2019

I've got a specific use case where I am calculating checksum/hash for the object contents based on the serialization output. Does GSON preserve the order of elements in an associative array?
For instance JSON doesn't support that. I've found many references that GSON maintains that order correctly, however I can't find any official info about that.
Hope you can help to answer that. Thanks !

@natebrunette
Copy link
Member

Yes, it does.

@tomekit
Copy link
Author

tomekit commented Jun 4, 2019

Thank you for your response.
Is this behaviour documented either in the original: https://github.com/google/gson or in this repository?
Basically this is something I am going to rely on, looking for more assurance, especially that the is pretty lots of confusion in this topic.

@natebrunette
Copy link
Member

It's not explicitly documented, however we just read the json in the order we receive it. Feel free to run some tests yourself to verify the behavior.

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

No branches or pull requests

2 participants