这是我的模特:
public class Object
{
[JsonProperty(PropertyName = "test1")]
public string Test1 { get; set; }
[JsonProperty(PropertyName = "test2")]
public string Test2 { get; set; }
[JsonProperty(PropertyName = "_id")]
public ID Id { get; set; }
}
public class ID
{
[JsonProperty(PropertyName = "$id")]
public string Id { get; set; }
}
当我调试它时,正确显示每个值,但在JsonConvert之后。我是空的。我在这里做错了什么?
Json身体:
"test1: "sometext",
"test2": "sometext",
"_id": {
"$id": "thisisanidstring"
}