Django numpy JSON encoder
Introduction
Subclass of standard Django JSON encoder [1] that can encode some numpy types (integers, floats and arrays).
Installation
Supported Python versions are: 3.6 and 3.7-dev.
Supported Django versions are: 2.0
pip install --upgrade django-numpy-json-encoder
Usage
# -*- encoding: utf-8 -*-
# ! python3
import numpy as np
from django.http import JsonResponse
from django.views import View
from django_numpy_json_encoder.numpy_encoder import NumpyJSONEncoder
class ExampleView(View):
# noinspection PyMethodMayBeStatic
def post(self, *args, **kwargs):
numpy_array = np.random.rand(8, 42).astype(np.float32)
return JsonResponse(data={'array': numpy_array}, encoder=NumpyJSONEncoder, safe=True)
License
The MIT License (MIT)
Metadata
Release files for django-numpy-json-encoder 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| django-numpy-json-encoder-0.1.3.tar.gz | 3.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_numpy_json_encoder-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.9 kB
Release files / django-numpy-json-encoder-0.1.3.tar.gz
| Download URL | django-numpy-json-encoder-0.1.3.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bd99d535e6b726240cf2ef6a53c9421f46429b9411cf33ef5e0432783482f1d3
|
|
BLAKE2b-256 checksum How to use checksums |
50db952fa5eea7f99f61e2bd8fca51e444efd1f759121cc73e350fe45e270d85
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / django_numpy_json_encoder-0.1.3-py3-none-any.whl
| Download URL | django_numpy_json_encoder-0.1.3-py3-none-any.whl |
|---|---|
| Size | 3.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6e7674baf5269a48af61979af4b95c14b1754ad0dbb368d500b45cfe61bde548
|
|
BLAKE2b-256 checksum How to use checksums |
7a5457c6aaf9ad4adc4092ff7414343de53fbde78f38e8efc76e1dc33cebab25
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-numpy-json-encoder 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.