【发布时间】:2021-01-26 02:51:51
【问题描述】:
有人知道如何使用http 发布数组吗?
var headers = {"Accept": "application/json"};
var url = "https://...."
var response = await http.post(url,
body: {
....
},
我有一个名为 commentList 的参数。我需要通过 comment[0], comment[1]... 在正文中。
如何在体内使用for loop???
for(var i in list){
"comments"+"["+index+"]" = i;
index ++;
}
这里是邮递员的键和值
【问题讨论】:
-
对该数组进行 JSON 化怎么样?
-
@raina77 有什么例子吗?
-
@raina77ow 我想将其发布为
comment[0],comment[1]。提供的链接在我的情况下有效吗? -
只需在 jsonEncode @Tony 中传递整个数组