jsonfield 1.0.0

A reusable Django field that allows you to store validated JSON in your model.

django-jsonfield

django-jsonfield is a reusable Django field that allows you to store validated JSON in your model.

It silently takes care of serialization. To use, simply add the field to one of your models.

Python 3 & Django 1.7 supported!

Use PostgreSQL? 1.0.0 introduced a breaking change to the underlying data type, so if you were using < 1.0.0 please see before upgrading https://github.com/bradjasper/django-jsonfield/issues/57

Install

pip install jsonfield

Usage

from django.db import models
from jsonfield import JSONField

class MyModel(models.Model):
  json = JSONField()

Advanced Usage

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:

import collections
class MyModel(models.Model):
  json = JSONField(load_kwargs={'object_pairs_hook': collections.OrderedDict})

Other Fields

jsonfield.JSONCharField

If you need to use your JSON field in an index or other constraint, you can use JSONCharField which subclasses CharField instead of TextField. You'll also need to specify a max_length parameter if you use this field.

Compatibility

django-jsonfield supports Python 2.7-Python 3.3 and Django 1.4+

Why doesn't it support Python 2.6?

You actually might be OK if you don't use an OrderedDict, but there are some issues with the simplejson API that make it cumbersome to support.

Why doesn't it support Django 1.3?

There was a bug that could only be fixed by a feature in Django 1.4. Read More if you're interested in the details.

Travis CI

Changes

v1.0.0, 9/4/2014 -- Removed native JSON datatype support for PostgreSQL & added Python 3.4 to tests

v0.9.23, 9/3/2014 -- Allowed tests to run in older versions of Django

v0.9.22, 7/10/2014 -- Added Django 1.7 support

v0.9.21, 5/26/2014 -- Added better support for Python 3 and tests for regex lookups

v0.9.20, 11/14/2013 -- Fixed load_kwargs on form fields, added Django 1.6 to automated tests

v0.9.19, 09/18/2013 -- Fixed changes to django.six.with_metaclass that broke django-jsonfield for Django 1.6

v0.9.18, 08/23/2013 -- Fixed bugs with South datamigration

v0.9.17, 06/07/2013 -- Fixed bugs in JSONCharField admin form

v0.9.14/15/16, 04/29/2013 -- Python 3 support added!

v0.9.11/12/13, 03/26/2013 -- PyPi changes

v0.9.9/10/11, 03/21/2013 -- PyPi changes

v0.9.8, 03/21/2013 -- Added support for native PostgreSQL JSON data type

v0.9.7, 03/21/2013 -- Fix bug #33 where JSONField didn't correctly store some values inside of strings

MIT

Author

Brad Jasper

Pip

jsonfield==1.0.0

Classifiers

  • Programming Language :: Python :: 3.4
  • Programming Language :: Python :: 3.3
  • Programming Language :: Python :: 3.2
  • Programming Language :: Python :: 3
  • Programming Language :: Python :: 2.7
  • Programming Language :: Python
  • Operating System :: OS Independent
  • Intended Audience :: Developers
  • Framework :: Django
  • Environment :: Web Environment
File Type Python Version Uploaded On Downloads
jsonfield-1.0.0.tar.gz Source Sept. 4, 2014 71,214
Version Release Date
1.0.0 Sept. 4, 2014
0.9.23 Sept. 3, 2014
0.9.22 July 10, 2014
0.9.20 Nov. 14, 2013
0.9.19 Sept. 18, 2013
0.9.18 Aug. 23, 2013
0.9.17 June 7, 2013
0.9.15 May 1, 2013
0.9.14 May 1, 2013
0.9.13 March 26, 2013
0.9.12 March 26, 2013
0.9.11 March 22, 2013
0.9.10 March 22, 2013
0.9.9 March 22, 2013
0.9.8 March 22, 2013
0.9.7 March 22, 2013
0.9.6 March 10, 2013
0.9.5 Feb. 12, 2013
0.9.4 Jan. 28, 2013
0.9.2 Jan. 11, 2013
0.9 March 8, 2012
0.8 March 8, 2012
0.7 Feb. 8, 2012
0.6 Feb. 1, 2015
Date Package Version Action
Feb. 1, 2015, 4:48 p.m. jsonfield 0.9.15 Release Created
Feb. 1, 2015, 4:48 p.m. jsonfield 0.9.14 Release Created
Feb. 1, 2015, 4:48 p.m. jsonfield 0.9.17 Release Created
Feb. 1, 2015, 4:48 p.m. jsonfield 0.9.11 Release Created
Feb. 1, 2015, 4:48 p.m. jsonfield 0.9.10 Release Created
Feb. 1, 2015, 4:48 p.m. jsonfield 0.9.13 Release Created
Feb. 1, 2015, 4:48 p.m. jsonfield 0.9.12 Release Created
Feb. 1, 2015, 4:48 p.m. jsonfield 0.9.19 Release Created
Feb. 1, 2015, 4:48 p.m. jsonfield 0.9.18 Release Created
Feb. 1, 2015, 4:48 p.m. jsonfield 0.9.9 Release Created
Feb. 1, 2015, 4:48 p.m. jsonfield 0.9.8 Release Created
Feb. 1, 2015, 4:48 p.m. jsonfield 0.9.7 Release Created
Feb. 1, 2015, 4:48 p.m. jsonfield 0.9.6 Release Created
Feb. 1, 2015, 4:48 p.m. jsonfield 0.9.5 Release Created
Feb. 1, 2015, 4:48 p.m. jsonfield 0.9.4 Release Created
Feb. 1, 2015, 4:48 p.m. jsonfield 0.9.2 Release Created
Feb. 1, 2015, 4:48 p.m. jsonfield 0.9.20 Release Created
Feb. 1, 2015, 4:48 p.m. jsonfield 0.9.22 Release Created
Feb. 1, 2015, 4:48 p.m. jsonfield 0.9.23 Release Created
Feb. 1, 2015, 4:48 p.m. jsonfield 0.6 Release Created
Feb. 1, 2015, 4:48 p.m. jsonfield 0.7 Release Created
Feb. 1, 2015, 4:48 p.m. jsonfield 1.0.0 Release Created
Feb. 1, 2015, 4:48 p.m. jsonfield 0.8 Release Created
Feb. 1, 2015, 4:48 p.m. jsonfield 0.9 Release Created
Feb. 1, 2015, 4:48 p.m. jsonfield Package Created