Why does Django return postgres JSONField value as string?

Turns out you cannot use django-jsonfield and Django's native JSONField in the same project or will you run into the weird behavior as described in the question


For me the problem was that the database was created from a backup and the column type was set to text when it should have been either json or jsonb.

Cleaning any invalid json then altering the column type with the following:

ALTER TABLE t ALTER COLUMN j TYPE jsonb USING j::text::jsonb;

(thanks to https://stackoverflow.com/a/28076909/2362877)