
Security News
GitHub Actions Pricing Whiplash: Self-Hosted Actions Billing Change Postponed
GitHub postponed a new billing model for self-hosted Actions after developer pushback, but moved forward with hosted runner price cuts on January 1.
jsonfield2
Advanced tools
.. image:: https://circleci.com/gh/rpkilby/jsonfield2.svg?style=shield :target: https://circleci.com/gh/rpkilby/jsonfield2 .. image:: https://codecov.io/gh/rpkilby/jsonfield2/branch/master/graph/badge.svg :target: https://codecov.io/gh/rpkilby/jsonfield2 .. image:: https://img.shields.io/pypi/v/jsonfield2.svg :target: https://pypi.org/project/jsonfield2 .. image:: https://img.shields.io/pypi/l/jsonfield2.svg :target: https://pypi.org/project/jsonfield2
ARCHIVE NOTICE: This package has been deprecated and merged back into jsonfield.
jsonfield2 is a reusable model field that allows you to store validated JSON, automatically handling
serialization to and from the database. To use, add jsonfield.JSONField to one of your models.
Note: django.contrib.postgres_ now supports PostgreSQL's jsonb type, which includes extended querying
capabilities. If you're an end user of PostgreSQL and want full-featured JSON support, then it is
recommended that you use the built-in JSONField. However, jsonfield2 is still useful when your app
needs to be database-agnostic, or when the built-in JSONField's extended querying is not being leveraged.
e.g., a configuration field.
.. _django.contrib.postgres: https://docs.djangoproject.com/en/dev/ref/contrib/postgres/fields/#jsonfield
jsonfield2 aims to support all current versions of Django_, however the explicity tested versions are:
.. _versions of Django: https://www.djangoproject.com/download/#supported-versions
.. code-block:: python
pip install jsonfield2
.. code-block:: python
from django.db import models
from jsonfield import JSONField
class MyModel(models.Model):
json = JSONField()
By default python deserializes json into dict objects. This behavior differs from the standard json behavior because python dicts do not have ordered keys. To overcome this limitation and keep the sort order of OrderedDict keys the deserialisation can be adjusted on model initialisation:
.. code-block:: python
import collections
class MyModel(models.Model):
json = JSONField(load_kwargs={'object_pairs_hook': collections.OrderedDict})
jsonfield.JSONCharField
Subclasses models.CharField instead of models.TextField.
The test suite requires tox and tox-venv.
.. code-block:: shell
$ pip install tox tox-venv
To test against all supported versions of Django, install and run tox:
.. code-block:: shell
$ tox
Or, to test just one version (for example Django 2.0 on Python 3.6):
.. code-block:: shell
$ tox -e py36-django20
.. code-block:: shell
$ pip install -U pip setuptools wheel twine
$ rm -rf dist/ build/
$ python setup.py sdist bdist_wheel
$ twine upload -r test dist/*
$ twine upload dist/*
Take a look at the changelog_.
.. _changelog: https://github.com/rpkilby/jsonfield2/blob/master/CHANGES.rst
FAQs
A reusable Django field that allows you to store validated JSON in your model.
We found that jsonfield2 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
GitHub postponed a new billing model for self-hosted Actions after developer pushback, but moved forward with hosted runner price cuts on January 1.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.