I'm using JavaScriptSerializer.Deserialize()
to get data from a JSON file.
But it ignores the decimal period, although using .GetType()
on the value, returns System.Decimal
.
This is the C# code:
JavaScriptSerializer jss = new JavaScriptSerializer();
Dictionary< string, object > dic = jss.Deserialize< Dictionary< string, object >>( json );
This is the JSON:
{ "num": 3.14 }
I try this: Console.WriteLine ( "{0} {1}", dic["num"].GetType(), dic["num"] );
And get this: System.Decimal 314
PS: I'm new to .NET as you can see.