我很难为我的字典实现这种结构,这就是我想要实现的:
{
"document_requested": {
"type": "endorsement"
},
"where_needed": "For employment",
"copies": 3,
"special_instructions": "Test instruction"
}
这就是我目前所拥有的
var params = [String:AnyObject]()
params["where_needed"] = requestParams["where_needed"]
params["copies"] = requestParams["number_of_copies"]
params["special_instructions"] = requestParams["special_instructions"]
我现在的问题是如何添加这部分
"document_requested": {
"type": "endorsement"
}
在我的 params 变量中。
非常感谢
最佳答案
您可以这样添加:
params["document_requested"] = ["type":"endorsement"]
关于swift - swift 中的嵌套字典,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35684972/