django-jsonfield =================== .. image:: https://codeship.com/projects/2e1a3d30-7db7-0132-629f-4abd151a3721/status?branch=default I had a serious need for a JSON field for django. There were a couple out there, but none packaged up nicely on bitbucket/github that were usable with ``pip install -e``. So I took the code from `David Cramer's blog`_, and packaged it up. Usage ----- To use, just install the package, and then use the field:: from django.db import models import jsonfield class MyModel(models.Model): the_json = jsonfield.JSONField() You can assign any JSON-encodable object to this field. It will be JSON-encoded before being stored in the database as a text value and it will be turned back into a python list/dict/string upon retrieval from the database. There is also a ``TypedJSONField``, that allows you to define data types that must be included within each object in the array. More documentation to follow. Notes ~~~~~ If no ``default`` is provided, and ``null=True`` is not passed in to the field constructor, then a default of ``{}`` will be used. Supported django versions ------------------------- All versions of Django from 1.8 onwards are tested, however, if you are using Postgres, I highly recommend that you consider using the ``django.contrib.postgres`` module's ``JSONField`` instead. Extras ------ jsonify templatetag ~~~~~~~~~~~~~~~~~~~ This allows you to convert a python data structure into JSON within a template:: {% load jsonify %} Note that you must only use the "safe" filter when you use the jsonify filter within a