So, I try to deserialize JSON file that has a format
"farmableitem": [
{
"@uniquename": "T1_FARM_CARROT_SEED",
"@tier": "1",
"@kind": "plant",
"@weight": "0.1",
"harvest": {
"@growtime": "79200",
"@lootlist": "T1_CARROT_LOOT",
"@lootchance": "1",
"@fame": "100",
"seed": {
"@chance": "0.0000",
"@amount": "1"
}
}
},
{
"@uniquename": "T5_FARM_OX_BABY",
"@tier": "5",
"@kind": "animal",
"@weight": "1.5",
"grownitem": {
"@uniquename": "T5_FARM_OX_GROWN",
"@growtime": "504000",
"@fame": "300",
"offspring": {
"@chance": "0.7867",
"@amount": "1"
}
}
]
As you can see, "harvest" and "grownitem", as well as, "seed" and "offspring" are basically the same... So there is no reason for me to create two different classes.
I know that if you want to give a specific field two different PropertyNames you can do the next:
[JsonProperty("first")]
public string Test { get; set; }
[JsonProperty("second")]
private string _test { set { Test = value; } }
However, I'm not sure that I can do the same thing for the classes... At least I couldn't find a solution.
So, long story short, I want to have two different JsonPropertyName for one class. Is it possible?