static void Main(string[] args) { string JsonMassive = ""; HttpWebRequest request = WebRequest.Create(uri) as HttpWebRequest; using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) using (Stream stream = response.GetResponseStream()) using (StreamReader reader = new StreamReader(stream)) { JsonMassive = reader.ReadToEnd(); } JsonClass json = WorkWithInfo.ParseJson(JsonMassive); Console.WriteLine(json.photos.First().camera.full_name); foreach (var item in json.photos) { Console.WriteLine("Id = " + item.id); Console.WriteLine("sol = " + item.sol); } }
public static JsonClass ParseJson(string jsonMassive) { JsonClass json = JsonConvert.DeserializeObject <JsonClass>(jsonMassive); return(json); }