django-rest-framework icon indicating copy to clipboard operation
django-rest-framework copied to clipboard

JSON response: getting List of List insted of JSON data

Open ramukodandapuram opened this issue 9 years ago • 1 comments

Hi , I am getting below error

views1 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 required 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.

ramukodandapuram avatar Nov 14 '17 14:11 ramukodandapuram

Hi,

The discussion group is the best place to take this discussion and other usage questions. Thanks!

xordoquy avatar Nov 14 '17 14:11 xordoquy