Answer the question
In order to leave comments, you need to log in
How to access nested data (json) correctly?
I have JSON like this:
{
"answer": "success",
"data": [
{
"id": "1",
"gn": "2",
"mar": "3",
"mo": "4",
"mdf": "5"
},
{
"id": "1",
"gn": "2",
"mar": "3",
"mo": "4",
"mdf": "5"
}
]
}
public class Rootobject
{
public string answer { get; set; }
public Datum[] data { get; set; }
}
public class Datum
{
public string id { get; set; }
public string gn{ get; set; }
public string mar { get; set; }
public string mo { get; set; }
public string mdf{ get; set; }
}
var test = JsonConvert.DeserializeObject<Rootobject>(answres);
System.Diagnostics.Debug.WriteLine(test.answer);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question