#33424: Jsonfield data being returned as str
-------------------------------------+-------------------------------------
Reporter: nitishxp | Owner: nobody
Type: Bug | Status: new
Component: | Version: 3.2
Uncategorized | Keywords: Database, Django
Severity: Normal | Cursor
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Hi,
I encountered a bug in raw postgresql query
from django.db.models import JSONField
from django.db import connection
class Job(models.Model):
job_dict = JsonField()
def view(request):
with connection.cursor() as cursor:
cursor.execute("select job_dict from app.job", ())
column_names = [desc[0] for desc in cursor.description]
results = [dict(zip(column_names, row)) for row in
cursor.fetchall()]
The given result will have the job_dict column as string instead of
dictionary
--
Ticket URL: <https://code.djangoproject.com/ticket/33424>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/051.5a239008f8b95695fa462aa0f6a820a2%40djangoproject.com.