Registry / web-framework / django-jsoneditor

django-jsoneditor

JSON →
library0.2.4pypypi✓ verified 81d ago

Django-JSONEditor is an online structured JSON input widget for Django that enhances the editing experience for various JSONField implementations. It integrates the core JSONEditor JavaScript library (from jsoneditoronline.org) into Django's admin interface and forms. The library is currently at version 0.2.4, with its last release in February 2023, and shows an active but somewhat dated approach to JSON editing within the Django ecosystem, with discussions around newer alternatives.

pip install django-jsoneditor
INSTALL
IMPORT
SIG · DJANGO-JSONEDITOR
D
django-jsoneditor
web-frameworkpythonv0.2.4
Install
1.6s avg
Import
Disk
18MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.2.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.915 runs
installs and imports cleanly · install 0.0s · import 0.000s · 20.3MB
glibc
py 3.103.915 runs
installs and imports cleanly · install 1.6s · import 0.000s · 21MB
18MB installed
● package 18MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

JSONEditor
import jsoneditor
from jsoneditor import JSONEditor

To quickly integrate `django-jsoneditor` into your Django admin, add `jsoneditor` to your `INSTALLED_APPS` and then override the default widget for `JSONField` in your `admin.py` using `formfield_overrides`. Ensure you have an appropriate `JSONField` defined in your model, such as `django.db.models.JSONField` (for Django 3.1+ or with PostgreSQL) or a compatible third-party `JSONField`.

# settings.py INSTALLED_APPS = [ # ... 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'jsoneditor', # Add this line # ... ] # models.py (Example using Django's native JSONField) from django.db import models class MyModel(models.Model): name = models.CharField(max_length=255) data = models.JSONField(default=dict) def __str__(self): return self.name # admin.py from django.contrib import admin from django.db import models from .models import MyModel from jsoneditor.forms import JSONEditor @admin.register(MyModel) class MyModelAdmin(admin.ModelAdmin): formfield_overrides = { models.JSONField: {'widget': JSONEditor}, }
Debug
Known issues
gotchaThis library only provides a widget for editing JSON data. It does NOT provide a `JSONField` itself. You must use Django's built-in `django.db.models.JSONField` (available from Django 3.1+, or with `django.contrib.postgres` for older versions) or a compatible third-party `JSONField` package.
fix
Ensure your model's JSON field is defined using `django.db.models.JSONField` or a compatible alternative like `django-jsonfield`.
affects: All versions
gotchaThe underlying JavaScript JSON Editor library (which uses the Ace editor) is considered by some to be 'out-of-date' and can experience issues with very large JSON documents (e.g., crashing, reverting to `TextArea` in read-only mode). Newer alternatives like `django-svelte-jsoneditor` exist.
fix
For basic use cases, this may not be an issue. For highly interactive, large-document, or modern UI needs, consider evaluating `django-svelte-jsoneditor` or other alternatives.
affects: All versions
gotchaCustomizing the JSON Editor's JavaScript initialization (e.g., setting default modes or options) requires copying the library's `init.js` file to your static storage and configuring `JSON_EDITOR_INIT_JS` in your Django settings to point to your modified copy.
fix
Refer to the GitHub README's 'Custom JSONEditor initialization' section for detailed steps on setting `JSON_EDITOR_INIT_JS` and modifying the `init.js` file.
affects: All versions
Upgrade
Version history
0.2.4latest on PyPI · released Feb 15, 2023
Audit
Dependencies
DjangorequiredCore framework integration.
django.contrib.postgres.fields.JSONFieldoptionalProvides the underlying JSONField functionality for Django >= 1.9; django-jsoneditor provides the widget only. Can also be a third-party JSONField.
Agent activity
7 hits · last 30 days
node
6
Resources