1đź‘Ť
There is no JSON in the example you show. You have a Python dictionary. If you then “store it in a textfield” (note it would have been helpful to show exactly how you are doing that) you have presumably just dumped it as a string into that field. It’s still not JSON, it’s now a string representation of a Python dict, which isn’t quite the same thing. json.load
will “not work” (once again, exact error message would have been helpful) becaase it’s not JSON.
You could try using json.dumps(my_dict)
before storing it in the database, and json.loads()
on the way out. Alternatively, use one of the many JSONField implementations you can probably find on a quick Google search.
👤Daniel Roseman
Source:stackexchange.com