Django Creating an object with data in a JSONField


Example

Pass data in native Python form, for example list, dict, str, None, bool, etc.

IceCream.objects.create(metadata={
    'date': '1/1/2016',
    'ordered by': 'Jon Skeet',
    'buyer': {
         'favorite flavor': 'vanilla',
         'known for': ['his rep on SO', 'writing a book']
     },
    'special requests': ['hot sauce'],
})

See the note in the "Remarks" section about using JSONField in practice.