I do have these JSON text to deserialize (they are part of bigger structure, just to keep it simple):
{"name":"whatever","value":0}
{"name":"objectProperty","value":{"A":1,"B":2,"C":3,"D":4}}
when I do want to deserialize into the C# object:
public class Rootobject
{
public string name { get; set; }
public int value { get; set; }
}
I will get in 1st case:
whatever : 0
in the second case I get:
objectProperty : {object}
the problem is that I'm not able to get any value from the
{object}
.
when I do use this C# class to deserialize:
public class Rootobject
{
public string name { get; set; }
public Value value { get; set; }
}
public class Value
{
public int A { get; set; }
public int B { get; set; }
public int C { get; set; }
public int D { get; set; }
}
I will get an error:
Expecting state 'Element'.. Encountered 'Text' with name '', namespace ''.
Is there a way how to tell deserializer to which class it should deserialize? Or any idea how to solve this problem?
thx,
R.