json - Django JSONField: Unexpected array element -


i trying save record jsonfield in django declared this:

class myclass(models.model):    myfield = jsonfield() 

with code fragment:

myclass.objects.create(myfield = {'a': 1, 'b': 2}) 

but results in

dataerror: malformed array literal: "{"a": 1, "b": 2}" line 1: ... '{"a": 1, ...              ^ detail:  unexpected array element. 

i trying following example described here: https://docs.djangoproject.com/en/1.10/ref/contrib/postgres/fields/

can point out missing here please?


Comments

Popular posts from this blog

'hasOwnProperty' in javascript -

python - ValueError: No axis named 1 for object type <class 'pandas.core.series.Series'> -

java - How to provide dependency injections in Eclipse RCP 3.x? -