#33424: Jsonfield data being returned as str
-------------------------------------+-------------------------------------
Reporter: nitishxp | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 3.2
Severity: Normal | Resolution:
Keywords: Database, Django | Triage Stage:
Cursor | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by nitishxp:
Old description:
> 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
New description:
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#comment:1>
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/066.59fac3b54c1ea56d9898dca4187ad3da%40djangoproject.com.