Есть json
. Пытаюсь через Newtonsoftjson
привести его к классу. Выдает ошибку. Вроде все делаю как раньше. Не пойму в чем ошибка
var m = JsonConvert.DeserializeObject<Rootobject>(json).Property1.Select(x=>x.value).ToList();
public class Rootobject
{
public Class1[] Property1 { get; set; }
}
public class Class1
{
public string value { get; set; }
public string label { get; set; }
public string firm { get; set; }
}
[
{
"value": "CL",
"label": "CL",
"firm": "ACURA"
},
{
"value": "CSX",
"label": "CSX",
"firm": "ACURA"
}
]
Newtonsoft.Json.JsonSerializationException: "Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'Rootobject' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.