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

Built-in support for numpy data-types #732

Open
lunik1 opened this issue Sep 3, 2024 · 0 comments
Open

Built-in support for numpy data-types #732

lunik1 opened this issue Sep 3, 2024 · 0 comments

Comments

@lunik1
Copy link

lunik1 commented Sep 3, 2024

Description

Hi,

Would there be any interest in adding support for numpy datatypes? Currently, attempting to encode these fails:

import msgspec.json as mjson
import numpy as np

mjson.encode(np.float64(1.0))
Traceback (most recent call last):
  File "<input>", line 4, in <module>
    mjson.encode(np.float64(1.0))
TypeError: Encoding objects of type numpy.float64 is unsupported

This seems like quite a common use case given the popularity of numpy, and to me it seems there are fairly obvious target data JSON types in most situations.

OTOH I appreciate that this can be done via extensions and that trying to support every third party library under the sun is like painting the Forth Bridge.

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

1 participant