我有以下帶有base64圖像內容的JSON字符串。你能幫助我,我怎麼能張貼此JSON作爲多部分:Android使用POST方法向服務器傳遞JSON數據
{
"TakeoffID": "2",
"address": ",nexhex",
"city": "Xrk Zed",
"state": "AZ",
"date": "12/08/2015",
"ViewNote": "",
"ViewPhoto1": "base64ImageContent",
"ViewPhoto2": "base64ImageContent",
"ViewPhoto3": "base64ImageContent",
"TakeoffDoneBy": "Jxehx",
"AcctName": "Gsgve",
"LoginUserID": "46669",
"jobId": "whshs",
"LineItems": [
{
"OrderLineid": "544",
"OrderLineTypeid": "Post Light",
"OrderLineQty": "2",
"OrderLinePhoto1": "base64ImageContent",
"OrderLinePhoto2": "base64ImageContent",
"OrderLinePhoto3": "base64ImageContent",
"OrderLineNotes": "",
"OrderLineLocation": "Post Lights"
}
]
}
由於它是Base64編碼圖像,您不應該只發送一個普通的'application/json'請求嗎?去[OkHttp食譜](https://github.com/square/okhttp/wiki/Recipes)。它擁有你所需要的一切。 –
確實。將json作爲多部分發送是沒有意義的。 – greenapps
@Ravi,你有沒有試過下面的答案,它工作嗎? – Hits