crate-python icon indicating copy to clipboard operation
crate-python copied to clipboard

TypeError: Type is not JSON serializable: `numpy.ndarray`/`recarray`

Open amotl opened this issue 5 months ago • 1 comments

Problem

We probed JSON serialization with crate-python and discovered it does not work well in all situations yet, for example when the data payload includes an array/list, and is read from JSON using pandas or Polars.

{"foo":"bar","baz":["qux"]}

The reason is that the decoded payload includes numpy.ndarray or recarray types.

Reproduce

cratedb-orjson.py can be used to reproduce the problem.

References

  • https://github.com/crate/cratedb-toolkit/issues/482

amotl avatar Jul 09 '25 23:07 amotl