-2
這應該是很簡單的......我只是想創建以下JSON輸出作爲HttpResponse對象:輸出Json字符串?
{ "status": "OK", "verified": true }
但出於某種原因不斷收到錯誤。
這應該是很簡單的......我只是想創建以下JSON輸出作爲HttpResponse對象:輸出Json字符串?
{ "status": "OK", "verified": true }
但出於某種原因不斷收到錯誤。
想通了。我這樣做了:
results= [{"status": "INVALID_REQUEST", "verified": False}]
return HttpResponse(simplejson.dumps(results), mimetype='application/json')
爲什麼不能這樣工作呢?
results= [{"status": "INVALID_REQUEST", "verified": False}]
output = serializers.serialize('json', results, indent=2)
return HttpResponse(output, mimetype='application/json')
解釋......你給我們你想要什麼,而不是實際的代碼.. – reagan 2012-07-10 03:42:46
這是一個可怕的問題。你甚至不會提供代碼語言,我假設一種服務器端語言,但你甚至不會讓我們知道實際的錯誤是什麼。 – iambriansreed 2012-07-10 05:44:33