Transparent dumps and loads of numpy-arrays. If a list is loaded from a json string it is given to numpy.array(). If further, the resulting array has a primitive type of either (int, float) it is returned by loads.
install
pip install json-numpy-sebastian-achim-mueller
Encoder
to dump with json.dumps().
object_hook
to load with json.loads().
example
import numpy
import json_numpy
obj = json_numpy.loads(s='{"a": [1.0, NaN]}')
assert isinstance(obj["a"], numpy.ndarray)
json_numpy.dumps(obj)
'{"a": [1.0, NaN]}'
Metadata
Release files for json-numpy-sebastian-achim-mueller 0.1.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| json_numpy_sebastian_achim_mueller-0.1.9.tar.gz | 4.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| json_numpy_sebastian_achim_mueller-0.1.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.4 kB
Release files / json_numpy_sebastian_achim_mueller-0.1.9.tar.gz
| Download URL | json_numpy_sebastian_achim_mueller-0.1.9.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
81de3f4d8494d97659f6b6591377a23e450221c5d5b0e66e24e848903b2f7a85
|
|
BLAKE2b-256 checksum How to use checksums |
21997b3adc1ebb468b834a6e0625fc98659af3e9a56fc7f10ec0242456c94003
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.5
|
Release files / json_numpy_sebastian_achim_mueller-0.1.9-py3-none-any.whl
| Download URL | json_numpy_sebastian_achim_mueller-0.1.9-py3-none-any.whl |
|---|---|
| Size | 4.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3669284fd617b8169ef07063b097188704456ced86aa075f98779c91d6863817
|
|
BLAKE2b-256 checksum How to use checksums |
e44b0ffd60649e704b1695e31518bf1b00b11d58a33caf2ee2b5202bfb2167ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.5
|