title: c# deserializing JSON web api response
body: <p>I need a little help from somebody who can tell me where my mistake is.<br>
  I have an API which returns JSON code:</p>
  
  <pre><code>{"block4o": {
     "id": 20153910,
     "name": "Block4o",
     "profileIconId": 616,
     "revisionDate": 1408967362000,
     "summonerLevel": 30
  }}
  </code></pre>
  
  <p>I tried to desearialize it but without success. I am using NewtonSoft.Json from NuGet. Here is my code:  </p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using System.IO;
  using System.Net;
  using Newtonsoft.Json;
  
  namespace ConsoleApplication37
  {
      class Program
      {
  
          class MyData
          {
              public long id { get; set; }
              public string name { get; set; }
              public int profileIconId { get; set; }
              public long revisionDate { get; set; }
              public long summonerLevel { get; set; }
          }
  
          static void Main()
          {
              WebRequest request = WebRequest.Create(
                "https://eune.api.pvp.net/api/lol/eune/v1.4/summoner/by-name/Block4o?api_key=****");
              request.Credentials = CredentialCache.DefaultCredentials;
              WebResponse response = request.GetResponse();
              Stream dataStream = response.GetResponseStream();
              StreamReader reader = new StreamReader(dataStream);
              string responseFromServer = reader.ReadToEnd();
              Console.WriteLine(responseFromServer);
              reader.Close();
              response.Close();
              Console.ReadKey();
  
              MyData tmp = JsonConvert.DeserializeObject&lt;MyData&gt;(responseFromServer);
              Console.WriteLine("{0}",tmp.id);
              Console.ReadKey();
          }
  
      }
  }
  </code></pre>
  
  <p>P.S It works if the response is like this:  </p>
  
  <pre><code>{
     "id": 20153910,
     "name": "Block4o",
     "profileIconId": 616,
     "revisionDate": 1408967362000,
     "summonerLevel": 30
  }
  </code></pre>