Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            using (var webClient = new WebClient())

            {
                // get a string representation of our JSON.
                String rawJSON = webClient.DownloadString("http://snap.stanford.edu/data/amazon/productGraph/categoryFiles/reviews_Books_5.json.gz");
                // convert the JSOn string to a series of object.
                booktitlecollection booktitlecollection = JsonConvert.DeserializeObject <booktitlecollection>(rawJSON);
                // do some computation.
                Console.WriteLine(booktitlecollection.Booktitles.Count);
            }
        }
        static ShowBooks()
        {
            using (var webClient = new WebClient())

            {
                // get a string representation of our JSON.
                String rawJSON = webClient.DownloadString("http://snap.stanford.edu/data/amazon/productGraph/categoryFiles/reviews_Books_5.json.gz");
                // convert the JSOn string to a series of object.
                booktitlecollection booktitlecollection = JsonConvert.DeserializeObject <booktitlecollection>(rawJSON);
                // do some computation.
                Console.WriteLine(booktitlecollection.Booktitles.Count);

                // take the objects parsed from JSON, and give them to my static collection.
                AllBooktitles = booktitlecollection.Booktitles;
            }
        }