I have JSON which looks like the following:
[
{
"id": 7,
"name": "Example 1",
"player_class": 2,
"player_class_name": "Class1",
"url": "/someurl",
"standard_ccp_signature_core": {
"as_of": "2019-07-04T16:46:23.760Z",
"format": 2,
"components": [ 742, 51779, 51790, 503, 52810, 52819, 381, 49164, 48886, 56223 ]
},
"wild_ccp_signature_core": null
}
]
The generated class looks like the following:
public class Archetype
{
public int id { get; set; }
public string name { get; set; }
public string player_class_name { get; set; }
[JsonProperty("standard_ccp_signature_core")]
public StandardCcpSignatureCore core_cards { get; set; }
}
public class StandardCcpSignatureCore
{
public List<int> components { get; set; }
}
I would like to simplify the Archetype
class a little so that it looks like this:
public class Archetype
{
public int id { get; set; }
public string name { get; set; }
public int player_class { get; set; }
public string player_class_name { get; set; }
[JsonProperty("standard_ccp_signature_core")]
public List<int> components { get; set; }
}
Is this possible using the Newtonsoft deserializer? I am pretty sure I have to setup a JsonObject
attribute on the components property of my Archetype
class, but am unsure of how to tell it how to do this.