Skip to main content

Posts

Showing posts from December, 2014

How to parse JSON data with .Net C#?

There are many occasions arise when we have to get some information form websites, websites offer information to their user in different formats and JSON is one of them. Actually you can parse JSON data in C# itself by writing some code but JSON.Net library will help a great deal. Example  Let's consider an example where we have to get tweets count of a webpage from twitter. Twitter provides us with an easy way to do that by simply sending a request to one of its urls Request Sample  https://cdn.api.twitter.com/1/urls/count.json?url=http://download.cnet.com/Free-PDF-to-JPG-Converter/3000-2016_4-75728284.html Request Response string  Response = {" count ":10,"url":"http:\/\/download.cnet.com\/Free-PDF-to-JPG-Converter\/3000-2016_4-75728284.html\/"} Here we go, we need to get count variable from that response. Create a Class in C# and add this code public class SharesCount { private int Count_; public int Count