Skip to main content

paper-jsoneditor

JSON input widget for paper-admin.

PyPI Build Status Software license

Compatibility

  • python >= 3.6
  • django >= 3.1
  • paper-admin >= 6.0

Installation

Install the latest release with pip:

pip install paper-jsoneditor

Add paper_jsoneditor to your INSTALLED_APPS in django's settings.py:

INSTALLED_APPS = (
    # other apps
    "paper_jsoneditor",
)

Usage

from django.db import models
from django.utils.translation import gettext_lazy as _
from paper_jsoneditor.fields import JSONField


class SampleModel(models.Model):
    data = JSONField(_("JSON"))

    class Meta:
        verbose_name = _("Sample")

Result: image

Preserving JSON object keys order

By default, Django uses the jsonb internal type for JSONField (for PostgreSQL).

From the Postgres documentation:

<...> jsonb does not preserve white space, does not preserve the order of object keys, and does not keep duplicate object keys. If duplicate keys are specified in the input, only the last value is kept.

In general, most applications should prefer to store JSON data as jsonb, unless there are quite specialized needs, such as legacy assumptions about ordering of object keys.

If you really do need to preserve the key order, use OrderedJSONField. It uses the TEXT type to store data:

from django.db import models
from django.utils.translation import gettext_lazy as _
from paper_jsoneditor.fields import OrderedJSONField


class SampleModel(models.Model):
    data = OrderedJSONField(_("JSON"))

    class Meta:
        verbose_name = _("Sample")

Metadata

Release files for paper-jsoneditor 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for paper-jsoneditor 0.4.1
File Size Uploaded
paper-jsoneditor-0.4.1.tar.gz 907.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for paper-jsoneditor 0.4.1
File Interpreter ABI Platform
paper_jsoneditor-0.4.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 1.8 MB

Release files / paper-jsoneditor-0.4.1.tar.gz

Download URL paper-jsoneditor-0.4.1.tar.gz
Size 907.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9423b4ca7825d88b898267dd0acb6541929737c13a95aaa2bc407d919f46b5b7
BLAKE2b-256 checksum
How to use checksums
1aa08f27e6f7f409fa3ff14394d83c19713b31c822fee791264b1fcd037f2db8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release files / paper_jsoneditor-0.4.1-py2.py3-none-any.whl

Download URL paper_jsoneditor-0.4.1-py2.py3-none-any.whl
Size 915.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
ab38f6f5457273b67cecadb42c4ce5efb0f2a773089ed150c0ca5338c6b740dd
BLAKE2b-256 checksum
How to use checksums
f5ac07ef2322f19ccafd7b594a5b18a80a534f55c856ebf4b0644af6c3005b4f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release history Release notifications | RSS feed

This release

0.4.1 This release

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page