views:

923

answers:

1

OK, I'm using a JSON-enabled Rails web-service to provide data to an iPhone application. I'm finding my Integer values (IDs) are being interpreted by the json-framework as a NSDecimalNumber type. I need it as an integer. How can I get an integer value out of my NSDecimalNumber typed variable? I have tried everything I know, and I'm at my wits end.

+5  A: 

I'm not sure about JSON, but:

NSDecimalNumber inherits from NSNumber, so you could just use the NSNumber's -integerValue method.

Requires 10.5, but shouldn't be an issue.

Abizern