I'm trying to read the data in a Json, but for some reason I can't find my mistake. This is an example of what I'm looking for.
{
"number": 1,
"pencil":
{
"Array": [
{
"color":
{
"red": 0,
"green": 0,
"blue": 0
},
"id": 1234
},
{
"color":
{
"red": 100,
"green": 10,
"blue": 50
},
"id": 1235
},
]
},
"something_else": 2
}
I tried this line but it keeps doing error.
var test = JsonConvert.DeserializeObject<List<Pencil>>(jsonString);
I am trying to get the red, green blue value and the id, but I don't get how.
public class Pencil
{
public List<Color> colors {get; set;}
public int id;
}
public class Color
{
public int red;
public int green;
public int blue;
}