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

Replace json with orjson #19

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Replace json with orjson #19

wants to merge 1 commit into from

Conversation

fdlm
Copy link
Contributor

@fdlm fdlm commented Jun 21, 2024

Python's standard json library can produce invalid JSON files, for example if we serialize nan, +inf or -inf floating point values.

I replaced it with orjson, which is faster and produces compliant JSON files.

One important difference is that orjson serializes to bytes instead of str. I checked with some files, and the results of the old serialization with json and orjson were exactly the same, so I think we're fine.

@fdlm fdlm requested a review from alvesfelipe June 21, 2024 08:26
Copy link

@richard-vogl richard-vogl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good! I hope these bytes are still UTF-8 😄

@richard-vogl
Copy link

richard-vogl commented Jun 21, 2024

looks good! I hope these bytes are still UTF-8 😄

It appears it is UTF-8, just checked...
Screenshot 2024-06-21 at 11 19 05

Copy link
Member

@alvesfelipe alvesfelipe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ poetry lock and have fun!

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.

3 participants