Hi,

Anyone working today?

How can I force the NewtonSoft Json Serializer to serialize two decimals
the same way? decimal a = 1234.1200M; decimal b = 1234.12M;

var sa = JsonConvert.SerializeObject(new { value = a });var sb =
JsonConvert.SerializeObject(new {value =
b});Console.WriteLine(sa);Console.WriteLine(sb);

Results are: {"value":1234.1200} {"value":1234.12}

How can I force it to serialize them both with 4 decimals so the results
are identical?
Even simpler, ignoring the serializer, how can I make sa.ToString() ==
sb.ToString() ?
The Json Serializer is only doing a simple .ToString() behind the scenes.

Regards,
Corneliu

Reply via email to