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

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -