Mvc Controller.Json method serializes long number 3458764513820540917 to 3458764513820541000. I need POCO with int64 property. How can I serialize C# long to json string "3458764513820540917"?
1 Answer
All numbers in JavaScript are, in fact, 64-bit floats.
It looks to me like you're hitting the range/precision limitations of that format on the client-side, rather than this being a problem with (de)serialisation.
-
Ok. I don't any calculation on that number in javascript. Is it possible to serialize long integer to string? Jul 5, 2011 at 4:51
-
@Baurzhan: I should think so. It all depends on what/how you're serialising on the server-side. Something as simple as a
ToString
call on your long value might do the trick.– LukeHJul 5, 2011 at 9:02 -
I have class with property of type long. On server side i call method Json(<instance of class>) Jul 7, 2011 at 8:36