Suppose I have the following class in C#.
class MyClass
{
[JsonIgnore]
public Foo Foo { get; set; }
[JsonProperty("bar")]
private Bar Bar
{
get
{
return new Bar()
{
Foo = this.Foo,
}
}
set
{
this.Foo = value.Foo;
}
}
}
Now suppose I create the following instance:
var instance = new MyClass()
{
Foo = new Foo(){//init properties of Foo};
}
This gets serialized into json correctly, but does not get deserialized. The Bar.set() never seems to get invoked. Any idea why? I've been going over Newtonsoft documentation looking for a clue, but haven't found anything useful yet.