LyubomirRadev

Untitled

Sep 5th, 2023
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.34 KB | None | 0 0
  1. {"get":"leagues",
  2. "parameters":[],
  3. "errors":[],
  4. "results":1037,
  5. "paging":{"current":1,"total":1},
  6. "response":[{"league":{"id":4,"name":"Euro Championship","type":"Cup","logo":"https:\/\/media-2.api-sports.io\/football\/leagues\/4.png"},"country":{"name":"World","code":null,"flag":null},"seasons":[{"year":2008,"start":"2008-06-07","end":"2008-06-29","current":false,"coverage":{"fixtures":{"events":true,"lineups":true,"statistics_fixtures":false,"statistics_players":false},"standings":false,"players":true,"top_scorers":true,"top_assists":true,"top_cards":true,"injuries":false,"predictions":true,"odds":false}},{"year":2012,"start":"2012-06-08","end":"2012-07-01","current":false,"coverage":{"fixtures":{"events":true,"lineups":true,"statistics_fixtures":false,"statistics_players":false},"standings":false,"players":true,"top_scorers":true,"top_assists":true,"top_cards":true,"injuries":false,"predictions":true,"odds":false}},{"year":2016,"start":"2016-06-10","end":"2016-07-10","current":false,"coverage":{"fixtures":{"events":true,"lineups":true,"statistics_fixtures":true,"statistics_players":true},"standings":true,"players":true,"top_scorers":true,"top_assists":true,"top_cards":true,"injuries":false,"predictions":true,"odds":false}},{"year":2020,"start":"2019-03-21","end":"2021-07-11","current":true,"coverage":{"fixtures":{"events":true,"lineups":true,"statistics_fixtures":true,"statistics_players":true},"standings":true,"players":true,"top_scorers":true,"top_assists":true,"top_cards":true,"injuries":false,"predictions":true,"odds":false}}]},
  7. {"league":{"id":21,"name":"Confederations Cup","type":"Cup","logo":"https:\/\/media-3.api-sports.io\/football\/leagues\/21.png"},"country":{"name":"World","code":null,"flag":null},"seasons":[{"year":2009,"start":"2009-06-14","end":"2009-06-28","current":false,"coverage":{"fixtures":{"events":true,"lineups":true,"statistics_fixtures":false,"statistics_players":false},"standings":false,"players":true,"top_scorers":true,"top_assists":true,"top_cards":true,"injuries":false,"predictions":true,"odds":false}},{"year":2013,"start":"2013-06-15","end":"2013-06-30","current":false,"coverage":{"fixtures":{"events":true,"lineups":true,"statistics_fixtures":false,"statistics_players":false},"standings":false,"players":true,"top_scorers":true,"top_assists":true,"top_cards":true,"injuries":false,"predictions":true,"odds":false}},{"year":2017,"start":"2017-06-17","end":"2017-07-02","current":true,"coverage":{"fixtures":{"events":true,"lineups":true,"statistics_fixtures":true,"statistics_players":false},"standings":false,"players":true,"top_scorers":true,"top_assists":true,"top_cards":true,"injuries":false,"predictions":true,"odds":false}}]},{"league":{"id":61,"name":"Ligue 1","type":"League","logo":"https:\/\/media-3.api-sports.io\/football\/leagues\/61.png"},"country":{"name":"France","code":"FR","flag":"https:\/\/media-2.api-sports.io\/flags\/fr.svg"},"seasons":[{"year":2010,"start":"2010-08-07","end":"2011-05-29","current":false,"coverage":{"fixtures":{"events":true,"lineups":true,"statistics_fixtures":false,"statistics_players":false},"standings":true,"players":true,"top_scorers":true,"top_assists":true,"top_cards":true,"injuries":false,"predictions":true,"odds":false}},{"year":2011,"start":"2011-08-06","end":"2012-05-20","current":false,"coverage":{"fixtures":{"events":true,"lineups":true,"statistics_fixtures":false,"statistics_players":false},"standings":true,"players":true,"top_scorers":true,"top_assists":true,"top_cards":true,"injuries":false,"predictions":true,"odds":false}},{"year":2012,"start":"2012-08-10","end":"2013-05-26","current":false,"coverage":{"fixtures":{"events":true,"lineups":true,"statistics_fixtures":false,"statistics_players":false},"standings":true,"players":true,"top_scorers":true,"top_assists":true,"top_cards":true,"injuries":false,"predictions":true,"odds":false}},{"year":2013,"start":"2013-08-09","end":"2014-05-17","current":false,"coverage":{"fixtures":{"events":true,"lineups":true,"statistics_fixtures":false,"statistics_players":false},"standings":true,"players":true,"top_scorers":true,"top_assists":true,"top_cards":true,"injuries":false,"predictions":true,"odds":false}},{"year":2014,"start":"2014-08-08","end":"2015-05-23","current":false,"coverage":{"fixtures":{"events":true,"lineups":true,"statistics_fixtures":false,"statistics_players":false},"standings":true,"players":true,"top_scorers":true,"top_assists":true,"top_cards":true,"injuries":false,"predictions":true,"odds":false}},{"year":2015,"start":"2015-08-07","end":"2016-05-14","current":false,"coverage":{"fixtures":{"events":true,"lineups":true,"statistics_fixtures":true,"statistics_players":true},"standings":true,"players":true,"top_scorers":true,"top_assists":true,"top_cards":true,"injuries":false,"predictions":true,"odds":false}},{"year":2016,"start":"2016-08-12","end":"2017-05-20","current":false,"coverage":{"fixtures":{"events":true,"lineups":true,"statistics_fixtures":true,"statistics_players":true},"standings":true,"players":true,"top_scorers":true,"top_assists":true,"top_cards":true,"injuries":false,"predictions":true,"odds":false}},{"year":2017,"start":"2017-08-04","end":"2018-05-19","current":false,"coverage":{"fixtures":{"events":true,"lineups":true,"statistics_fixtures":true,"statistics_players":true},"standings":true,"players":true,"top_scorers":true,"top_assists":true,"top_cards":true,"injuries":false,"predictions":true,"odds":false}},{"year":2018,"start":"2018-08-10","end":"2019-05-24","current":false,"coverage":{"fixtures":{"events":true,"lineups":true,"statistics_fixtures":true,"statistics_players":true},"standings":true,"players":true,"top_scorers":true,"top_assists":true,"top_cards":true,"injuries":false,"predictions":true,"odds":false}},{"year":2019,"start":"2019-08-09","end":"2020-05-23","current":false,"coverage":{"fixtures":{"events":true,"lineups":true,"statistics_fixtures":true,"statistics_players":true},"standings":true,"players":true,"top_scorers":true,"top_assists":true,"top_cards":true,"injuries":false,"predictions":true,"odds":false}},{"year":2020,"start":"2020-08-21","end":"2021-05-30","current":false,"coverage":{"fixtures":{"events":true,"lineups":true,"statistics_fixtures":true,"statistics_players":true},"standings":true,"players":true,"top_scorers":true,"top_assists":true,"top_cards":true,"injuries":true,"predictions":true,"odds":false}},{"year":2021,"start":"2021-08-06","end":"2022-05-29","current":false,"coverage":{"fixtures":{"events":true,"lineups":true,"statistics_fixtures":true,"statistics_players":true},"standings":true,"players":true,"top_scorers":true,"top_assists":true,"top_cards":true,"injuries":true,"predictions":true,"odds":false}},{"year":2022,"start":"2022-08-05","end":"2023-06-03","current":false,"coverage":{"fixtures":{"events":true,"lineups":true,"statistics_fixtures":true,"statistics_players":true},"standings":true,"players":true,"top_scorers":true,"top_assists":true,"top_cards":true,"injuries":true,"predictions":true,"odds":false}},{"year":2023,"start":"2023-08-13","end":"2024-05-18","current":true,"coverage":{"fixtures":{"events":true,"lineups":true,"statistics_fixtures":true,"statistics_players":true},"standings":true,"players":true,"top_scorers":true,"top_assists":true,"top_cards":true,"injuries":true,"predictions":true,"odds":true}}]}
  8.  
  9. I have the following classes:
  10.  
  11. using Newtonsoft.Json;
  12.  
  13. using System.Collections.Generic;
  14.  
  15. namespace FootballLeaguesStandingsTableProject.Models
  16. {
  17. public class FootballCountryModel
  18. {
  19. [JsonProperty("id")]
  20. public int ID { get; set; }
  21.  
  22. [JsonProperty("name")]
  23. public string Name { get; set; }
  24.  
  25. [JsonProperty("logo")]
  26. public string Logo { get; set; }
  27.  
  28.  
  29.  
  30. }
  31.  
  32. public class Results
  33. {
  34.  
  35. [JsonProperty("league")]
  36. public Dictionary<string, FootballCountryModel> JsonResults { get; set; }
  37. }
  38.  
  39. public class JsonRootObject
  40. {
  41. [JsonProperty("response")]
  42. public Results Rslt { get; set; }
  43. }
  44.  
  45. public class LeaguesDeserializedModel
  46. {
  47. [JsonProperty("parameters")]
  48. public object Parameters { get; set; }
  49.  
  50. [JsonProperty("errors")]
  51. public object Errors { get; set; }
  52.  
  53. [JsonProperty("results")]
  54. public int Results { get; set; }
  55.  
  56.  
  57. [JsonProperty("paging")]
  58. public object Pagin { get; set; }
  59.  
  60. [JsonProperty("response")]
  61. public List<FootballCountryModel> Response { get; set; }
  62. }
  63. }
  64.  
  65. And I use this do deserialize:
  66. dynamic jsonObj = JsonConvert.DeserializeObject<Results>(response.Content);
  67.  
Advertisement
Add Comment
Please, Sign In to add comment