我是Swift编程语言的新手。解析json时我有疑问。我对json中参数的定义如下
let params = [
["name":"action", "value":"pay"],
[
"name":"cartJsonData",
"value":[
"total":1,
"rows":[
[
"quantity":"1000",
"title":"Donation for SMSF India - General Fund",
"price":"1",
"itemId":"DN001",
"cost":"1000",
"currency":"INR"
]
]
]
],
["name":"center", "value":"Chennai"],
["name":"flatNumber", "value":"503"],
["name":"panNumber", "value":""],
["name":"payWith", "value":"CreditCard"],
["name":"reminderFrequency", "value":"Monthly"],
["name":"shipToAddr1", "value":"null"],
["name":"shipToAddr2", "value":"null"],
["name":"shipToCity","value":"null"],
["name":"shipToCountryName", "value":"India"],
["name":"shipToEmail", "value":"raoa@hotmail.com"],
["name":"shipToFirstName","value":"Barnie"],
["name":"shipToLastName","value":"Killian"],
["name":"shipToPhone", "value":"8754470650"],
["name":"shipToState", "value":"Telangana"],
["name":"shipToZip", "value":"500001"],
["name":"userId", "value":"test_id"],
["name":"shipToCountry", "value":"IN"]
]
我收到了上述错误。有人可以解释一下吗?
答案 0 :(得分:0)
以下是问题的答案。我对声明做了一些修改。
让params:[[String:AnyObject]] = [[“name”:“action”,“value”:“pay”],[“name”:“cartJsonData”,“value”:“{\” total \“:1,\”rows \“:[{\”quantity \“:\”(金额)\“,\”title \“:\”为SMSF印度捐赠 - 普通基金“,”价格“ “:\”1 \“,\”itemId \“:\”DN001 \“,\”费用\“:\”(金额)\“,\”货币\“:\”INR \“}]}”] ,[“name”:“center”,“value”:“Chennai”],[“name”:“flatNumber”,“value”:“503”],[“name”:“panNumber”,“value”: “(pan)”],[“name”:“payWith”],[“name”:“reminderFrequency”,“value”:“Monthly”],[“name”:“shipToAddr1”],[“name”: “shipToAddr2”],[“name”:“shipToCity”],[“name”:“shipToCountryName”,“value”:“India”],[“name”:“shipToEmail”,“value”:“(电子邮件! )“],[”name“:”shipToFirstName“,”value“:”(name!)“],[”name“:”shipToLastName“],[”name“:”shipToPhone“,”value“:”( mobile!)“],[”name“:”shipToState“],[”name“:”shipToZip“],[”name“:”userId“,”value“:”(userid)“],[”name“ :“shipToCountry”,“value”:“IN”]]