django-rest-framework
django-rest-framework copied to clipboard
JSON response: getting List of List insted of JSON data
Hi , I am getting below error
Code
from django.http import HttpResponse
from django.core.serializers import serialize
from rest_framework.views import APIView
from .models import Employee
from .serializers import EmployeeSerializers
#from sqlalchemy import create_engine
from django.db import connection
`
vews.py
class employee_list(APIView):
def get(self,request,format =None):
#engine =create_engine("mysql://root:Passw0rd@localhost/employee",echo=True)
cursor = connection.cursor()
cursor.callproc("Get_Usp_Employee")
employees=cursor.fetchall()
cursor.close()
return Response(employees)
`
Required output
I was failing to utilize the feauture of serilization, tried many ways but response was not satisfactory! pleas help me!! any help can be appreciated.
Hi,
The discussion group is the best place to take this discussion and other usage questions. Thanks!