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
jsoniter.Marshal makes ordered maps unordered #676
Comments
You try to marshal an umsorted map
|
This was a surprise to me, but you are right: the built-in encoding/json package documentation says: "Map values encode as JSON objects... The map keys are sorted and used as JSON object keys..."
You can't sort a map in Go. Maps have no guaranteed order. The only way to do it is to copy the key-value pairs into some other data structure. |
the map is ordered by sort. but jsoniter.Marshal make the map unordered. but json.Marshal json.Marshal
The text was updated successfully, but these errors were encountered: