I try to parse responce for:
https://api.betfair.com/exchange/bet...tion/menu.json
I tried to use:
List<RootObject> root_objects = JsonConvert.DeserializeObject<List<RootObject>>(re sponce);
but failed.
Where RootObject - is a class autogenerated with help of http://json2csharp.com/ - you paste there a json responce and this site generates proper .Net class, which could be used for deserizlization of json responce;
This site gave a workable class to deserialize GetAciveEventTypes responce, but failed for the market Menu
Here the class which the site generated:
public class Child7
{
public string type { get; set; }
public string name { get; set; }
public string id { get; set; }
public string exchangeId { get; set; }
public string marketType { get; set; }
public string marketStartTime { get; set; }
public int numberOfWinners { get; set; }
}
public class Child6
{
public string type { get; set; }
public string name { get; set; }
public string id { get; set; }
public string exchangeId { get; set; }
public string marketType { get; set; }
public string marketStartTime { get; set; }
public object numberOfWinners { get; set; }
public List<Child7> children { get; set; }
public string countryCode { get; set; }
}
public class Child5
{
public List<Child6> children { get; set; }
public string type { get; set; }
public string name { get; set; }
public string id { get; set; }
public string countryCode { get; set; }
public string exchangeId { get; set; }
public string marketType { get; set; }
public string marketStartTime { get; set; }
public object numberOfWinners { get; set; }
}
public class Child4
{
public List<Child5> children { get; set; }
public string type { get; set; }
public string name { get; set; }
public string id { get; set; }
public string countryCode { get; set; }
public string exchangeId { get; set; }
public string marketType { get; set; }
public string marketStartTime { get; set; }
public object numberOfWinners { get; set; }
}
public class Child3
{
public List<Child4> children { get; set; }
public string type { get; set; }
public string name { get; set; }
public string id { get; set; }
public string exchangeId { get; set; }
public string marketType { get; set; }
public string marketStartTime { get; set; }
public int? numberOfWinners { get; set; }
public string countryCode { get; set; }
}
public class Child2
{
public List<Child3> children { get; set; }
public string type { get; set; }
public string name { get; set; }
public string id { get; set; }
public string countryCode { get; set; }
public string venue { get; set; }
public string startTime { get; set; }
}
public class Child
{
public List<Child2> children { get; set; }
public string type { get; set; }
public string name { get; set; }
public string id { get; set; }
}
public class RootObject
{
public List<Child> children { get; set; }
public string type { get; set; }
public string name { get; set; }
public int id { get; set; }
}
Thanks for help
https://api.betfair.com/exchange/bet...tion/menu.json
I tried to use:
List<RootObject> root_objects = JsonConvert.DeserializeObject<List<RootObject>>(re sponce);
but failed.
Where RootObject - is a class autogenerated with help of http://json2csharp.com/ - you paste there a json responce and this site generates proper .Net class, which could be used for deserizlization of json responce;
This site gave a workable class to deserialize GetAciveEventTypes responce, but failed for the market Menu
Here the class which the site generated:
public class Child7
{
public string type { get; set; }
public string name { get; set; }
public string id { get; set; }
public string exchangeId { get; set; }
public string marketType { get; set; }
public string marketStartTime { get; set; }
public int numberOfWinners { get; set; }
}
public class Child6
{
public string type { get; set; }
public string name { get; set; }
public string id { get; set; }
public string exchangeId { get; set; }
public string marketType { get; set; }
public string marketStartTime { get; set; }
public object numberOfWinners { get; set; }
public List<Child7> children { get; set; }
public string countryCode { get; set; }
}
public class Child5
{
public List<Child6> children { get; set; }
public string type { get; set; }
public string name { get; set; }
public string id { get; set; }
public string countryCode { get; set; }
public string exchangeId { get; set; }
public string marketType { get; set; }
public string marketStartTime { get; set; }
public object numberOfWinners { get; set; }
}
public class Child4
{
public List<Child5> children { get; set; }
public string type { get; set; }
public string name { get; set; }
public string id { get; set; }
public string countryCode { get; set; }
public string exchangeId { get; set; }
public string marketType { get; set; }
public string marketStartTime { get; set; }
public object numberOfWinners { get; set; }
}
public class Child3
{
public List<Child4> children { get; set; }
public string type { get; set; }
public string name { get; set; }
public string id { get; set; }
public string exchangeId { get; set; }
public string marketType { get; set; }
public string marketStartTime { get; set; }
public int? numberOfWinners { get; set; }
public string countryCode { get; set; }
}
public class Child2
{
public List<Child3> children { get; set; }
public string type { get; set; }
public string name { get; set; }
public string id { get; set; }
public string countryCode { get; set; }
public string venue { get; set; }
public string startTime { get; set; }
}
public class Child
{
public List<Child2> children { get; set; }
public string type { get; set; }
public string name { get; set; }
public string id { get; set; }
}
public class RootObject
{
public List<Child> children { get; set; }
public string type { get; set; }
public string name { get; set; }
public int id { get; set; }
}
Thanks for help


Comment