iphone - JSON 的 NSMutableDictionary 表示

标签 iphone objective-c ios cocoa ipad

我现在面临一个真正的问题,我相信有人可以帮助我。

我有一个 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/

相关文章:

iphone - iOS 电子书应用程序创建者/制作者

iphone - 将自定义 NSURLProtocol 与 UIWebView 和 POST 请求一起使用

iphone - 在 iOS 中读取 PPT、xls 和 .doc 文件的 SDK

iphone - Web 服务或套接字级通信

ios - 在 iOS 6 中没有调用 shouldAutorotateToInterfaceOrientation

iphone - 使用 NSPredicate 从关系中检索核心数据中的信息

iphone - UICollectionView didselect 不起作用

ios - Objective-C 回调方法作为另一个类的参数

ios - MKAnnotationView 正在失去对 MKAnnotation 的引用

ios - 设置 map 中心和缩放以适合所有坐标