Sys.InvalidOperationException: Cannot serialize non finite numbers

I got the above error when passing data to a web service.  On the web service, a field is defined as int?.  But when I try to pass a null value, I get the above error because the value is showing up as NaN.  So it sees NaN and throws this exception.  As an alternative, I'm going to have to use a -1 instead, or convert the value to a string.I chose the conversion to a string as the option to use as I convert the values to a string to pass in serialized form, which turned out to be the best option.  It really worked well for passing data to/from client and server.