React Native JSONSerialization



我有一个 NSDictionary

   address =     {
        address1 = "Ivy House";
        address2 = "Sandy Lane";
        city = Rush;
        country = Ireland;
        county = Dublin;
        email = "notknown@whatever.com";
        mobile = "<null>";
        postCode = "<null>";
        smsAlert = "<null>";
        telephone = 18437584;
        websiteAddress = "www.example.com";
    };

我需要传递它以将本机响应为接受 JSON 采用这种格式的启动选项。 (引号和 = 替换为 : 等(

  RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
                                                      moduleName:@"spotlight"
                                               initialProperties:nil
                                                   launchOptions:launchOptions];

杰伦

"address":
       {
           "address1": "Ivy House",
           "address2": "Sandy Lane",
           "city": "Rush",
           "postCode": null,
           "email": "notknown@whatever.com",
           "telephone": "18437584",
           "mobile": null,
           "smsAlert": null,
           "county": "Dublin",
           "country": "Ireland",
           "websiteAddress": "www.example.com"
       },

转换我的字典以便 react native 接受它的最佳方法是什么?

将地址设置为constvar,并以这些相同数字彼此相等的格式标记代码的其余部分,但采用const格式。例如:

    const address =     {
            address1: {
  }
}

相关内容

  • 没有找到相关文章

最新更新