using System IO using System Net using System Text using Newtonsoft Js

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
using System.IO;
using System.Net;
using System.Text;
using Newtonsoft.Json;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
HttpWebRequest songRequest = (HttpWebRequest)WebRequest.Create("http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=dockgg&api_key=e28039161acc777b14cfb09eb41ef896&limit=1&format=json");
HttpWebResponse songResponse = (HttpWebResponse)songRequest.GetResponse();
string songResult = new StreamReader(songResponse.GetResponseStream(), Encoding.UTF8).ReadToEnd();
songResult = songResult.Replace("{\"#", "{\"");
songResult = songResult.Replace("@","");
var result = JsonConvert.DeserializeObject<RootObject>(songResult);
}
}
}