serializers.serialize('json', data) return text

15 views
Skip to first unread message

Yossef Vecsler

unread,
Feb 12, 2019, 7:21:39 AM2/12/19
to Django users
hi,

i am using:
"serializers.serialize('json', data)"
to make a json (i also use json.dumps in other cases).

how can i make "serializers.serialize('json'data)" to return json to the js?
because now i must make:
ans = the ajax returns -> "serializers.serialize('json'data)"
JSON.parse(ans)

while when using json.dumps its straight forward with no parsing the data...

thanks

Jason

unread,
Feb 12, 2019, 7:44:01 AM2/12/19
to Django users
Check out JSONResponse
Reply all
Reply to author
Forward
0 new messages