Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.77 KB | None | 0 0
  1. [
  2. {
  3. "id": 1,
  4. "name": "Poczta",
  5. "description": "Opis",
  6. "latitude": 52.25197,
  7. "longitude": 20.896355,
  8. "accuracy": 0,
  9. "type": "",
  10. "image": null
  11. },
  12. {
  13. "id": 2,
  14. "name": "WAT",
  15. "description": "Budynek główny - sztab.rnzażółć gęślą jaźń",
  16. "latitude": 52.2531213,
  17. "longitude": 20.8995849,
  18. "accuracy": 0,
  19. "type": "Uczelnia",
  20. "image": null
  21. },
  22. {
  23. "id": 3,
  24. "name": "Przychodnia",
  25. "description": "Opis",
  26. "latitude": 52.250808,
  27. "longitude": 20.895348,
  28. "accuracy": 0,
  29. "type": "",
  30. "image": null
  31. },
  32. {
  33. "id": 4,
  34. "name": "DS3",
  35. "description": "Opis",
  36. "latitude": 52.250063,
  37. "longitude": 20.895847,
  38. "accuracy": 0,
  39. "type": "",
  40. "image": null
  41. },
  42. {
  43. "id": 5,
  44. "name": "DS2",
  45. "description": "Opis",
  46. "latitude": 52.2497674,
  47. "longitude": 20.8966583,
  48. "accuracy": 0,
  49. "type": "",
  50. "image": null
  51. },
  52. {
  53. "id": 6,
  54. "name": "DS1",
  55. "description": "Opis",
  56. "latitude": 52.25088,
  57. "longitude": 20.897492,
  58. "accuracy": 0,
  59. "type": "",
  60. "image": null
  61. },
  62. {
  63. "id": 7,
  64. "name": "DS4",
  65. "description": "To jest opis",
  66. "latitude": 52.2539982,
  67. "longitude": 20.8971716,
  68. "accuracy": 0,
  69. "type": "",
  70. "image": null
  71. },
  72. {
  73. "id": 15,
  74. "name": "a",
  75. "description": "b",
  76. "latitude": 52.250105,
  77. "longitude": 20.896124,
  78. "accuracy": 0,
  79. "type": "Uczelnia",
  80. "image": null
  81. }
  82. ]
  83.  
  84. async private void webServiceGetPoints()
  85. {
  86. try
  87. {
  88. var client = new HttpClient();
  89. var response = await client.GetAsync(new Uri("\private\"));
  90. var result = await response.Content.ReadAsStringAsync();
  91.  
  92.  
  93. List<WebServiceTag> convert = JsonConvert.DeserializeObject<List<WebServiceTag>>(result) as List<WebServiceTag>;
  94.  
  95. Debug.WriteLine(convert.Count);
  96. }
  97. catch (JsonSerializationException jsonerr)
  98. {
  99. Debug.WriteLine(jsonerr.ToString());
  100. }
  101. catch (Exception e)
  102. {
  103. Debug.WriteLine(e.ToString());
  104. }
  105. }
  106.  
  107. class WebServiceTag
  108. {
  109.  
  110. [JsonProperty("id")]
  111. public int id { get; set; }
  112.  
  113. [JsonProperty("name")]
  114. public string name { get; set; }
  115.  
  116. [JsonProperty("description")]
  117. public string description { get; set; }
  118.  
  119. [JsonProperty("latitude")]
  120. public double latitude { get; set; }
  121.  
  122. [JsonProperty("longitude")]
  123. public double longitude { get; set; }
  124.  
  125. [JsonProperty("accuracy")]
  126. public int accuracy { get; set; }
  127.  
  128. [JsonProperty("type")]
  129. public string type { get; set; }
  130.  
  131. [JsonProperty("image")]
  132. public string image { get; set; }
  133. }
  134.  
  135. JsonConvert.DeserializeObject<List<T>>()
  136.  
  137. JsonConvert.DeserializeObject<IEnumerable<T>>()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement