problem: deserialize to decimal is not exactly

Aug 21, 2010 at 3:13 AM

I have problem when deserialize to decimal:

  Decimal number = JsonConvert.DeserializeObject<Decimal>("123456789876543.21");

limit to 15 digits:

  // number = 123456789876543

but, it must:

// number = 123456789876543.21

I known the reason, the JsonConvert use double to store the number (I can edit source code and use decimal).

In my business, I have a big money(over 15 digits) and it can’t store exactly

Why we don’t use decimal when deserialize?

 

Aug 23, 2010 at 12:46 PM

hi,

 

the way i solved this is to send it as a string to the client and then parsefloat on client side...

Coordinator
Sep 12, 2010 at 11:21 AM

I've fixed this bug in the latest version of the source code

http://json.codeplex.com/SourceControl/list/changesets