[Answer]-Django JSON string to json object

1👍

I think you should be able to just remove the json.dumps part of the script. That’s a python command to translate a valid JSON object into a string!

data = list(Data.objects.all().values('deviceId','payload'))

0👍

To store JSON I recommended to use JSONField.

from jsonfield import JSONField
class Data(models.Model):
    deviceId = models.CharField(max_length=200)
    payload = models.JSONField(max_length=2000)
👤slav

Leave a comment