let newTodo = [
"currentPageNo" : (page.description) ,
"type": "basic_search",
"searchParams": [
"remember_search" : checkk ,
"u_seeking": (bsMatch_looking) ,
"age_from" : (bsMatch_agefrom) ,
"age_to": (bsMatch_ageto),
"u_looking_for_value" :(bsMatch_lookingfoevalue),
"u_country": (bsMatch_country) ,
"u_state" : (bsMatch_ustate) ,
"u_city": (bsMatch_city) ,
"u_postalcode" : (bsMatch_postelcode) ,
"distance": (bsMatch_distance) ,
]
] as [String : AnyObject]
响应如下
["type": basic_search , "currentPageNo": 1 ,"searchParams": {
"age_from" = 18;
"age_to" = 44;
distance = 0;
"remember_search" = On;
"u_city" = "";
"u_country" = 1;
"u_looking_for_value" = 0;
"u_postalcode" = "";
"u_seeking" = Female;
"u_state" = California;
}]
但是我想要这种类型的响应,我该怎么做,只有黄铜才会给我带来问题,请为我提供解决方案
[{ "currentPageNo": 1, "type": basic_search ,"searchParams": {
"age_from" = 20;
"age_to" = 35;
distance = 100;
"remember_search" = On;
"u_city" = London;
"u_country" = 222;
"u_looking_for_value" = "0";
"u_postalcode" = "";
"u_seeking" = Male;
"u_state" = England;
}}]
我想将第一个代码转换为第二个类型
最佳答案
您可以通过使用 Int 类型的键来订购它们。
var myDictionary: [Int: [String: String]]?
关于swift - 在 alamofire 中通过 POST 传递复杂参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57460185/