Can I Deserialize a JSON string that contains 0.0 in C#? -


the json i'm getting webservice has integer incorrectly represented 0.0. deserialization code looks this:

var serializer = new jsonserializer(); var ret = serializer.deserialize<t>(jsontextreader); 

and error this:

input string '0.0' not valid integer.

my question is, there way specify less strict deserialization method can parse string?

edit: web service returns no schema don't know why deserializer tries convert int instead of float or double.

i'd should go ahead , creat classes on json -> c#

var o = (jobject)serializer.deserialize(myjsondata); 

you can use c# dynamic type make things easier. technique makes re-factoring simpler not rely on magic-strings. use jsonconvert.deserializeobject<dynamic>()to deserialize string dynamic type access properties in usual way in c#.

im not sure why youre getting

input string '0.0' not valid integer.

since if dont have json data should left @ null , shouldnt have problem


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -