title: Could not Cast or Convert System.String to Class object
body: <p>I am trying to deserialize a JSON string received from a Web API</p>
  
  <pre><code>try
  {
      string r = await App.client.GetUser();
  
      App.Authentication = JsonConvert.DeserializeObject&lt;ApiResult&gt;(r);
  
      await DisplayAlert("TEST", App.Authentication.ToString(), "OK");
  
      Application.Current.MainPage = new Schedule();
  }
  catch (Exception p)
  {
      await DisplayAlert("Getting Authentication failed", p.ToString(), "TEST");
  }
  </code></pre>
  
  <p>However it gives the error: Could not Cast or Convert System.String to App1.ApiResult
  <code>App.Authentication = JsonConvert.DeserializeObject&lt;ApiResult&gt;(r);</code></p>
  
  <p>App.Authentication:</p>
  
  <pre><code>public static ApiResult Authentication = new ApiResult();`
  </code></pre>
  
  <p>JSON string:</p>
  
  <blockquote>
    <p>"\"{\\"status\\":\\"0\\",\\"message\\":{\\"ID\\":5,\\"FirstName\\":\\"John\\",\\"LastName\\":\\"Doe\\",\\"Email\\":\\"testemail@gmail.com\\",\\"Password\\":\\"testPass\\",\\"CreationDate\\":\\"2016-10-26T15:01:08\\",\\"RoleID\\":1,\\"doorCode\\":9999}}\""</p>
  </blockquote>
  
  <p>ApiResult Class:</p>
  
  <pre><code>public class ApiResult
  {
      public string status { get; set; }
      public Account message { get; set; }
  }
  </code></pre>
  
  <p>Account Class:</p>
  
  <pre><code>public class Account
  {
      public string status { get; set; }
      public int ID { get; set; }
      public string FirstName { get; set; }
      public string LastName { get; set; }
      public string Email { get; set; }
      public string Password { get; set; }
      public DateTime CreationDate { get; set; }
      public int RoleID { get; set; }
      public int doorCode { get; set; }
  }
  </code></pre>
  
  <p>The full error message:</p>
  
  <blockquote>
    <p>{"Error converting value
    \"{\"status\":\"0\",\"message\":{\"ID\":5,\"FirstName\":\"John\",\"LastName\":\"Doe\",\"Email\":\"testemail@gmail.com\",\"Password\":\"testPass\",\"CreationDate\":\"2016-10-26T15:01:08\",\"RoleID\":1,\"doorCode\":9999}}\"
    to type 'App1.ApiResult'. Path '', line 1, position 232."}</p>
  </blockquote>