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

Do not sort keys during json serialization #3386

Merged
merged 5 commits into from
Sep 16, 2021

Conversation

jonmmease
Copy link
Contributor

Closes #3380

This PR removes the instruction to the json/orjson engines to sort dict keys during serialization. This fixes #3380 and should improve serialization performance a little.

Also, while looking at the orjson option flags, I noticed that there is a OPT_NON_STR_KEYS option.

Serialize dict keys of type other than str. This allows dict keys to be one of str, int, float, bool, None, datetime.datetime, datetime.date, datetime.time, enum.Enum, and uuid.UUID. For comparison, the standard library serializes str, int, float, bool or None by default.

This would have been a better fix that what I did in #3351, so I made the change here.

@nicolaskruchten
Copy link
Contributor

@jonmmease is this one ready for review?

@jonmmease
Copy link
Contributor Author

yes

@nicolaskruchten nicolaskruchten merged commit ce0ed07 into master Sep 16, 2021
@archmoj archmoj deleted the json_remove_sort_keys branch November 23, 2021 23:36
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.

Handle serializing dicts with ints and strings
2 participants