Skip to main content

JSONField from django.contrib.postgres, but with a fallback to TextField

Project description

This is an extension to django.contrib.postgres.fields.JSONField, that works on other databases than PostgreSQL.

  • On MySQL and MariaDB, it uses the native JSON data type and supports most features.
  • On SQLite and all other databases, it just stores JSON strings in a text field and does not support querying.

This is tested against:

  • Python 3.4 to 3.6
  • Django 2.0 to 2.1
  • MySQL 5.7
  • MariaDB 10.3
  • PostgreSQL 9.4
  • SQLite (no querying funcationality)


Just use our drop-in replacement for JSONField:

from django.db import models
from jsonfallback.fields import FallbackJSONField

class Book(models.Model):
    data = FallbackJSONField()

    def __str__(self):
        return str(['title'])


The code in this repository is published under the terms of the Apache License. See the LICENSE file for the complete license text.

This project is maintained by Raphael Michel <>. See the AUTHORS file for a list of all the awesome folks who contributed to this project.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-jsonfallback, version 2.1.2
Filename, size File type Python version Upload date Hashes
Filename, size django_jsonfallback-2.1.2-py3-none-any.whl (6.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size django-jsonfallback-2.1.2.tar.gz (6.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page