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 -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -

How to understand 2 main() functions after using uftrace to profile the C++ program? -