title: Deserialize a multidimensional Json response
body: <p>I'm currently stuck on JSON deserialization.</p>
  
  <p>Here is two type of JSON, I can receive :</p>
  
  <pre><code>{
  
  "code": 0,
  "response": {
      "isFollowing": false,
      "isFollowedBy": false,
      "connections": {
          "google": {
              "url": "",
              "id": "c35f4e",
              "name": "jean"
          },
          "facebook": {
              "url": "https://www.facebook.com/",
              "id": "1000064139",
              "name": "jean mic"
          }
      },
      "isPrimary": true,
      "id": "780",
      "location": "",
      "isPrivate": false,
      "joinedAt": "2013-10-18T16:04:09",
      "username": "jeandavid",
      "numLikesReceived": 0,
      "about": "",
      "name": "jean",
      "url": "",
      "profileUrl": "",
      "reputation": ,
      "avatar": {
          "small": {
              "permalink": "https://picture.jpg",
              "cache": "https://picture.jpg"
          },
          "isCustom": false,
          "permalink": "https://picture.jpg",
          "cache": "/noavatar9.png",
          "large": {
              "permalink": "w",
              "cache": "https://picture.jpg"
          }
      },
      "isAnonymous": false
  }
  
  }
  </code></pre>
  
  <p>And this one :</p>
  
  <pre><code>{
  
  "response": [
      {
          "uid": 2017156,
          "first_name": "David",
          "last_name": "Jean",
          "sex": 1,
          "nickname": "",
          "bdate": "12.12.1990",
          "photo_medium": "img.jpg"
      }
  ]
  
  }
  </code></pre>
  
  <p>At beginning, I use :</p>
  
  <pre><code>Dictionary&lt;string, string&gt; deserializedObj = JsonConvert.DeserializeObject&lt;Dictionary&lt;string, string&gt;&gt;(response);
  </code></pre>
  
  <p>But it works only with unidimensional Json data.</p>
  
  <p>So after looking on Google, I tried to use :</p>
  
  <pre><code>JArray jArr = (JArray)JsonConvert.DeserializeObject(response);
  foreach (var item in jArr)
  {
  Console.WriteLine(item);
  }
  </code></pre>
  
  <p>But I receive this exception :</p>
  
  <blockquote>
    <p>Unable to cast object of type 'Newtonsoft.Json.Linq.JObject' to type 'Newtonsoft.Json.Linq.JArray'.</p>
  </blockquote>
  
  <p>For the first JSON data I would like to get the Google and Facebook data and also the username, the reputation, the avatar, the id of the user, ...</p>
  
  <p>Thanks for any help!!</p>