我的數據的API調用 - :我送JSON數據API,但得到的unicode JSON數據磨片從Android設備
{"op":"merge","merge_bcards_ids":{"data":[216,217]},"target_bacard_id":226}
鑑於文件我得到的JSON列表數據request.data [ 「merge_bcards_ids」]: -
[258, 259] <type 'list'> which is showing correct.
但是,當從外部設備則此API調用: -
[257,258] <type 'unicode'>
所以我想列表,而不是統一。請幫助我。
我的觀點是: -
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__
你能告訴我你的意見嗎? –
是的,我編輯了這個問題。 – user3048148
聽起來像客戶是問題所在。 –