My data -:
{"op":"merge","merge_bcards_ids":{"data":[216,217]},"target_bacard_id":226}
In view file I am getting json list data request.data["merge_bcards_ids"] :-
[258, 259] <type 'list'> which is showing correct.
But when this api call from external device then :-
[257,258] <type 'unicode'>
So I want list instead of unicode. Please help me out.
My view is :-
class BusinessViewSet(viewsets.ModelViewSet):
queryset = BusinessCard.objects.all()
serializer_class = BusinessCardSerializer
def create(self, request):
try:
op = request.data["op"]
except:
op = None
if op == 'merge':
try:
merge_bcards_ids = request.data["merge_bcards_ids"]
target_bacard_id = request.data["target_bacard_id"]
except:
merge_bcards_ids = None
target_bacard_id = None
print merge_bcards_ids
print merge_bcards_ids.__class__