I've raw JSON data that looks like this:
{
"Pages": 0,
"Page": null,
"Rows": null,
"OrderBy": null,
"Desc": false,
"TotalRows": 36,
"HasError": false,
"Error": null,
"Result": {
"fileTypes": [
{
"id": 22,
"description": "Cleaning Procedures",
"Codes": ""
},
{
"id": 32,
"description": "Data Drop",
"Codes": "[\"DB\",\"IE\"]"
},
{
"id": 4,
"description": "Data Sheet",
"Codes": ""
},
{
"id": 30,
"description": "Description of Operation",
"Codes": ""
},
{
"id": 11,
"description": "Diagram",
"Codes": ""
},
{
"id": 2,
"description": "Drawing",
"Codes": "[\"DR\"]"
}
]
}
}
And a C# Model
that looks like this:
public class Filetype
{
[JsonProperty("id")]
public int Id { get; set; }
[JsonProperty("description")]
public string Description { get; set; }
[JsonProperty("Codes")]
//public string Codes { get; set; }
public List<string> Codes { get; set; }
}
However, Newtonsoft is not deserializing the codes into a list of codes but rather returning
[\"DB\",\"IE\"]
in the first element of the list , or , "" , (null
).
Any help with this would be appreciated.