gpt4 book ai didi

java - Volley post 方法 JSONArray

转载 作者:行者123 更新时间:2023-12-02 02:10:13 26 4
gpt4 key购买 nike

任何人都可以建议我如何POST volley JSONArray正文

{
"mobileNo":"9876543210",
"dobDocuments" : [
"http://server.com/test/uploads/users/5ae699bb8ec8d8218f18c3b4/5ae699f58ec8d8218f18c3b5/dob_proofs/DOB Proof1.jpg","http://server.com/test/uploads/users/5ae699bb8ec8d8218f18c3b4/5ae699f58ec8d8218f18c3b5/dob_proofs/DOB Proof2.jpg"
],
"educationDocuments" : [
"http://server.com/test/uploads/users/5ae699bb8ec8d8218f18c3b4/5ae699f58ec8d8218f18c3b5/edu_proofs/EDU Proof1.jpg","http://server.com/test/uploads/users/5ae699bb8ec8d8218f18c3b4/5ae699f58ec8d8218f18c3b5/edu_proofs/EDU Proof2.jpg"
],
"addressDocuments" : [
"http://server.com/test/uploads/users/5ae699bb8ec8d8218f18c3b4/5ae699f58ec8d8218f18c3b5/add_proofs/ADD Proof1.jpg","http://server.com/test/uploads/users/5ae699bb8ec8d8218f18c3b4/5ae699f58ec8d8218f18c3b5/add_proofs/ADD Proof2.jpg"
]
}

对于这个实例,我有包含此数组数据的 Hashmap。

我搜索了很多,但没有找到这种类型的正确解决方案。谢谢..!

最佳答案

试试这个

    JSONObject sendObject = new JSONObject();
try {

JSONArray dobDocuments = new JSONArray();
dobDocuments.put("https://stackoverflow.com/questions/50128021/volley-post-method-jsonarray");
dobDocuments.put("https://stackoverflow.com/questions/50128021/volley-post-method-jsonarray");

JSONArray educationDocuments = new JSONArray();
educationDocuments.put("https://stackoverflow.com/questions/50128021/volley-post-method-jsonarray");
educationDocuments.put("https://stackoverflow.com/questions/50128021/volley-post-method-jsonarray");


JSONArray addressDocuments = new JSONArray();
addressDocuments.put("https://stackoverflow.com/questions/50128021/volley-post-method-jsonarray");
addressDocuments.put("https://stackoverflow.com/questions/50128021/volley-post-method-jsonarray");


sendObject.put("dobDocuments", dobDocuments);
sendObject.put("educationDocuments", addressDocuments);
sendObject.put("addressDocuments", addressDocuments);
sendObject.put("mobileNo", "9876543210");


} catch (JSONException e) {

}

Log.e("JSONObject",sendObject.toString());

输出

{
"dobDocuments": ["https:\/\/stackoverflow.com\/questions\/50128021\/volley-post-method-jsonarray", "https:\/\/stackoverflow.com\/questions\/50128021\/volley-post-method-jsonarray"],
"educationDocuments": ["https:\/\/stackoverflow.com\/questions\/50128021\/volley-post-method-jsonarray", "https:\/\/stackoverflow.com\/questions\/50128021\/volley-post-method-jsonarray"],
"addressDocuments": ["https:\/\/stackoverflow.com\/questions\/50128021\/volley-post-method-jsonarray", "https:\/\/stackoverflow.com\/questions\/50128021\/volley-post-method-jsonarray"],
"mobileNo": "9876543210"
}

关于java - Volley post 方法 JSONArray,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50128021/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com