Slt le forum, j'essaie en vain de parser le flux foursquare.
Et
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 var address = new Uri("https://api.foursquare.com/v2/venues/search?ll=40.7,-74"); var client = new WebClient(); client.DownloadStringCompleted +=ClientDownloadStringCompleted; client.DownloadStringAsync(address);
Mais je n'arrive pas à parser le flux json. Quelqu'un a une idée ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 private static void ClientDownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { var responseStream = e.Result; var raw = e.Result; JsonArray k; if (JsonValue.Parse(raw) as JsonArray == null) k = new JsonArray { JsonValue.Parse(raw) as JsonObject }; else k = JsonValue.Parse(raw) as JsonArray; foreach (JsonObject jo in k) { // id = (string)item.Element("id"), // name = (string)item.Element("name"), // address = (string)item.Element("address"), // city = (string)item.Element("city"), // state = (string)item.Element("state"), // zip = (string)item.Element("zip"), // geolat = (string)item.Element("geolat"), // geolong = (string)item.Element("geolong"), }
Merci
Partager