So i'm trying to get this JSON to parse correctly, but it just crashes. And http://json2csharp.com/ is not able to give me the right classes
This is the JSON:
[
{
"id": "2300",
"file_name": "2300_file",
"representations": {
"thumb": "thumb.jpeg",
"small": "small.jpeg",
"medium": "medium.jpeg",
"full": "2300.jpeg"
}
},
{
"id": "2c00",
"file_name": "2c00_file",
"representations": {
"thumb": "thumb.jpeg",
"small": "small.jpeg",
"medium": "medium.jpeg",
"full": "2c00.jpeg"
}
},
{
"id": "0800",
"file_name": "0800_file",
"representations": {
"thumb": "thumb.jpeg",
"small": "small.jpeg",
"medium": "medium.jpeg",
"full": "0800.jpeg"
}
}
]
And here is the current code I use:
public class Representations
{
public string thumb { get; set; }
public string small { get; set; }
public string medium { get; set; }
public string full { get; set; }
}
public class Picture
{
public string id { get; set; }
public string file_name { get; set; }
public Representations representations { get; set; }
}
private void button1_Click(object sender, EventArgs e)
{
Picture ImageThing = JsonConvert.DeserializeObject<Picture>(InputBox.Text); //Imputbox is where the json resides
MessageBox.Show(ImageThing.file_name);
}
So how can I make the MessageBox output the file_name of all the three objects individually?
Sorry for the low quality explanation, I'm tired and I just want to get this little thing working.