我现在面临一个真正的问题,我相信有人可以帮助我。
我有一个 JSON 帖子,它看起来像:
{
"CustomerAccount":{
"CustomerUID":"String content",
"UserName":"String content",
"Password":"String content",
"OldPassword":"String content",
"Email":"String content",
"QuestionUID":2147483647,
"QuestionAnswer":"String content",
"EAlerts":true
}
}
现在我有一个字典,它设置了 CustomerUID、UserName 等的值。现在如果我想绑定(bind)上层以将所有这些绑定(bind)到 CustomerAccount 并作为我的 JSONRepresentation 发送,有没有比实际创建一个新的更简单的方法字典并在此示例中设置键“CustomerAccount”的值?我相信可能有更好的方法来做到这一点。
谢谢。
最佳答案
不完全确定我是否遵循,但这可能是您想要的:
NSDictionary *dictA = <dictionary_with_customeruid_etc>;
NSDictionary *customerAccountDict = [NSDictionary dictionaryWithObjectsAndKeys:dictA, @"CustomerAccount", nil];
但我不确定我是否完全理解您的问题,所以也许您还想要其他东西。请让我们更多地了解您想要做什么。
关于iphone - JSON 的 NSMutableDictionary 表示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8811561/