NSDecimalValue not saved as a double , it is a 64-bit unsigned integer mantissa, an 8-bit integer with a base sign of 10, and a signed bit.
The problem is that the exact value of NSDecimalValue is only represented as ... an NSDecimalValue .
You can get an approximate value of 64EE IEE754 using the doubleValue method.
When you try to use longLongValue , you effectively get the casting result to a long int int of an approximate value of IEE754.
You may or may not consider this a mistake in the implementation of NSDecimalValue (and, ultimately, file a radar and ask Apple to use a different conversion procedure). But, strictly speaking, this is not a mistake: it is a design decision.
You should think of NSDecimalValue as a floating point decimal. In fact, it is very similar to the software implementation of what IEEE754 called a decimal floating-point number with extended precision, except that it does not meet this definition (since it does not have a metric that supports at least values ββfrom -6143 to +6144 and because it does not support NAN and endlessly).
In other words, this is not an extended implementation of an integer, it is an extended (but not having NAN and infinity) implementation of a double. The fact that Apple initially provides an approximate conversion to double (implying that the conversion to long long int may or may not be accurate for any value that exceeds 53 bits of precision) is not an error.
You may or may not want to implement another transformation yourself (with a category).
Another possible point of view is to consider a problem, which is a bug in the JSon implementation that you used. But this is also very controversial: he gave you an NSDecimalValue and that, perhaps, the correct representation. Either you work with NSDecimalValue or you are responsible for any conversion.