开发者

NSArray Help for breaking information

开发者 https://www.devze.com 2023-03-02 02:44 出处:网络
Hi i am getting one response from the server \"{\\\"bindings\\\":[{\\\"Latitude\\\":\\\"25.451808633333332\\\",\\\"Longitude\\\":\\\"81.83372523333333\\\"}]}\" , it is in array, i need to break the la

Hi i am getting one response from the server "{\"bindings\":[{\"Latitude\":\"25.451808633333332\",\"Longitude\":\"81.83372523333333\"}]}" , it is in array, i need to break the latitu开发者_开发知识库de and longitude part or values and initialize the value into another string.


NSString *latitudeString = [[[jsonDict objectForKey:@"bindings"]objectAtIndex:0]objectForKey:@"Latitude"];
NSString *longitudeString = [[[jsonDict objectForKey:@"bindings"]objectAtIndex:0]objectForKey:@"Longitude"];

In more nice way:

NSDictionary *gealocationDict = [[jsonDict objectForKey:@"bindings"]objectAtIndex:0];
NSString *latitudeString  = [gealocationDict objectForKey:@"Latitude"];
NSString *longitudeString = [gealocationDict bjectForKey:@"Longitude"];
0

精彩评论

暂无评论...
验证码 换一张
取 消