Skip to content

convert inf, -inf, nan to JSON #3280

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

Merged
merged 5 commits into from
Jul 22, 2025
Merged

convert inf, -inf, nan to JSON #3280

merged 5 commits into from
Jul 22, 2025

Conversation

d-v-b
Copy link
Contributor

@d-v-b d-v-b commented Jul 22, 2025

This PR ensures that we convert inf, -inf, and nan values to JSON by removing the "allow_nan=False" flag in json.dumps. Fixes #3279.

Note that because we serialize fill values to JSON-serializable values before invoking json.dumps, this has no impact on fill value serialization. It should only affect the contents of `attributes.

TODO:

  • Add unit tests and/or doctests in docstrings
  • Add docstrings and API docs for any new/modified user-facing classes and functions
  • New/modified features documented in docs/user-guide/*.rst
  • Changes documented as a new file in changes/
  • GitHub Actions have all passed
  • Test coverage is 100% (Codecov passes)

@github-actions github-actions bot added the needs release notes Automatically applied to PRs which haven't added release notes label Jul 22, 2025
@github-actions github-actions bot removed the needs release notes Automatically applied to PRs which haven't added release notes label Jul 22, 2025
@d-v-b d-v-b requested a review from a team July 22, 2025 12:12
@d-v-b d-v-b enabled auto-merge (squash) July 22, 2025 13:15
@d-v-b d-v-b merged commit 702f7b3 into zarr-developers:main Jul 22, 2025
28 checks passed
@d-v-b d-v-b deleted the allow-nan branch July 22, 2025 13:28
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.

regression in JSON serialization of numpy floats
2 participants