Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

django orm JSONField for mysql

I am trying to define a model with one column being a mysql json type. Searching on web results in suggestions related to django's postgresql support for JSONField type or django-jsonfield.

Is there currently no way django natively supports mysql's json type. Also while doing inspectdb a column of type json in mysql was assigned the type TextField with a comment This field type is a guess.

How would I declare my model in such a way that it supports json fields?

like image 282
Ishan Khare Avatar asked Oct 25 '25 04:10

Ishan Khare


1 Answers

UPDATE

As of Django 3.2, it now supports JSONField and django-mysql JSONField is now deprecated.


Check out django-mysql.

Django-MySQL supports the JSON data type and related functions through JSONField plus some JSON database functions.

like image 120
Guy S Avatar answered Oct 26 '25 17:10

Guy S



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!