我需要将以下参数发送到swift 3.0中的服务器。如何构建请求参数?
"step_1": [
{
"name": "",
"mobile": "",
"line_1": "",
"line_2": "",
"city": "",
"state": "",
"pincode": "",
"fax": "",
"gst": "",
"owner_name": "",
"dob": "",
"anniversary": ""
}
]
答案 0 :(得分:0)
对于上面的json数据,下面是字典代码:
let param = [["name": "abc",
"mobile": "123",
"line_1": "line_1",
"line_2": "line_2",
"city":"xyz",
"state":"abc",
"pincode":"000",
"fax":"123",
"gst":"gst",
"ownwer_name":"ownwer_name",
"dob":"xx-xx-xxxx",
"anniversary":"xx-xx-xxxx"]]
//Print data
print(param[0]["name"] as! String)
答案 1 :(得分:-1)
您好,我不确定它是否有效,但无论如何,试试这个
let params: ["step_1": [["name": "Some name",
"mobile": "12345678",
"line_1": "line_1 stuff",
"...": "..."]]]