everyone!
Please help me to get the total value from given dictionary
{
"@averageBaseRate" = "296.7";
"@averageRate" = "296.7";
"@commissionableUsdTotal" = "1186.8";
"@currencyCode" = USD;
"@maxNightlyRate" = "296.7";
"@nightlyRateTotal" = "1186.8";
"@total" = "1186.8";
NightlyRatesPerRoom = {
"@size" = 1;
NightlyRate = {
....
How can I get the value from total key. Neither I can apply valueForKey nor I can apply objectForKey.
Any help is highly appreciated !
It looks strange that you have "@total" instead of "total" - looks like @ is a part of NSString. Probably you created a NSString @"@total" which sounds like a bug. You should be able to access it with:
[dict objectForKey:@"@total"];
您可以使用它。
float total = [[yourDict objectForKey:@"@total"] floatValue];
Hey Buddy always use like this ........
with this line you get all value of ABC Key In your Array
[array addObject:[dict objectForKey:@"ABC"]];
如今,您甚至可以使用yourDict[@"yourkey"]
来获取为key存储的值。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.