Use JsonConvert.DeserializeObject
:
var rootObject = JsonConvert.DeserializeObject<RootObject>(result)
Question
i tested the json before i get result but tried to get more clear with this but it doesn't work
i don't need other solution to get table[0].id i want to know how to add all data to object
{"table:[{"name":"ali","id":"1","id_f":"1","x":"11","y":"10","r":"0","w":"100","h":"100"}]}
public class Table
{
public string name { get; set; }
public string id { get; set; }
public string id_f { get; set; }
public string x { get; set; }
public string y { get; set; }
public string o { get; set; }
public string w { get; set; }
public string h { get; set; }
}
public class RootObject
{
public List<Table> table { get; set; }
}
RootObject aa = new RootObject();
aa=JToken.Parse(result).ToObject<RootObject>();//result is the json data
ttt.Text = aa.table[0].id;
Solution
Use JsonConvert.DeserializeObject
:
var rootObject = JsonConvert.DeserializeObject<RootObject>(result)