im parsing a JSON and cant seem to extract an integer. If i do
int secondsLeft = [secondsList objectForKey:@"SecondsToStop"];
if I do NSLog(@”%@”,secondsLeft) it does however get outputted correctly in the console, but im unsure how to get a proper integer. Whats the proper way to parse numbers from a JSON object?
Your JSON parsing framework probably stored the number as an NSNumber.
According to the NSNumber documentation, you can call
intValueon the number to get its value as a plain old int: