2
我在Python下面的代碼:如何將Python POST數據轉換爲JSON?
def post(self):
example = self.request.get("example")
other = self.request.get("other")
如何獲取所有數據後如果不知道?我對Python很陌生,但是有一些東西:
def post(self):
array = self.request.get()
myJSON = MagicArrayToJson(array)
self.response.headers['Content-Type'] = 'application/json'
self.response.write(myJSON)
您必須指定你所使用的框架,因爲它並不明顯。到目前爲止,我的最佳猜測是您使用的是webapp2,但我不想猜測。 https://webapp-improved.appspot.com/guide/request.html指出請求有幾個屬性應該與您的問題相關,比如'self.request.body'。 – dyoo 2014-10-06 00:49:06