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

Open
#729 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
numpy, pandas, python
Domain
database

Research direction

Start with the cratedb-orjson.py reproduction linked in the issue and inspect how crate-python handles decoded payloads containing numpy.ndarray or recarray values. Confirm the failure with array/list data read through pandas or Polars; done means those payloads serialize without the reported TypeError.

Written by the indexing model from the issue text.

Description

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

Dominant language
Python
Stars
85
Forks
34
Avg merge
3d 1h
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from crate/crate-python

All issues in crate/crate-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.