JsonFx - parsing double to int

76 Views Asked by At

Given the following simple class I'm trying to deserialize with JsonFx:

public class JsonFxTest
{
    public int IntValue { get; set; }
    public JsonFxTest()
    {
    }
}

Note: I'm calling an API which I'm not the owner of, so I can't change what is given back!

Simplified, the following string is given back:

"{\"IntValue\" : \"20.00\"}"

which I want to deserialize using JsonReader.Deserialize<JsonFxTest>("{\"IntValue\" : \"20.00\"}").

The error thrown is:

20.00 is not a valid value for Int32.

which is totally fine and correct.

Question is, how can I parse it into an integer without using regex or something like this on the string received?

0

There are 0 best solutions below