﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
29077	[Help] Why JSONField for MySql/MariaDB etc are not supported in Django?	Akhil Lawrence	nobody	"JSON format is widely used these days. Databases like [MariaDB](https://mariadb.com/kb/en/library/json-data-type/), [MySql](https://dev.mysql.com/doc/refman/5.7/en/json.html) etc supports JSONField. But within Django, JSONField is only provided for the postgres. Why is it so? Is there any reason for this?

Also irrespective of whether the DB supports JSON datatype or not, JSON can be implemented by modifying TextField. And it believe it is very helpful. Why don't we simply provide it? Many programmers I know, do their custom implementation of JSONField on almost all their projects.
Something like this,

{{{
class JSONField(models.TextField):
    """""" JSON field implementation on top of django textfield """"""

    def to_dict(self, value):
        """""" convert json string to python dictionary """"""
        return json.loads(value)

    def to_json(self, value):
        """""" convert python dictionary to json string """"""
        return json.dumps(value)

    def from_db_value(self, value, expression, connection):
        """""" convert string from db to python dictionary """"""
        if value is None:
            return value
        return self.to_dict(value)

    def to_python(self, value):
        """""" convert model input value to python dictionary """"""
        if isinstance(value, dict):
            return value
        if value is None:
            return value
        return self.to_dict(value)

    def get_prep_value(self, value):
        """""" convert python dictionary to string before writing to db """"""
        return self.to_json(value)
}}}


Could you guys please clarify Django teams perspective on this.
"	Uncategorized	closed	Uncategorized	2.0	Normal	invalid	help		Unreviewed	0	0	0	0	0	0
