Hi Shreehari
On 16/04/2020 10.17, shreehari Vaasistha L wrote:
Object of type ValueError is not JSON serializable
getting this above error
First of all, don't highjack other unrelated threads. Create your own
with a descriptive subject.
You get the error because of the lines:
except Exception as e:
return Response(e)
You cannot serialize the exception object, but your real problem is most
likely the actual exception being thrown.
Try to remove the entire try/except block. You most likely don't want to
return errors in your code to the user anyway so returning an HTTP 500
to the user and letting Django write the exception message and
stacktrace in your log is probably much better.
Kind regards,
Kasper Laudrup
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/c6c85506-e72b-fd3f-b79a-67412641007b%40stacktrace.dk.