title: Deserialize JSON when a value can be an object or an empty array
body: <p>I`m working with VK API. Sometimes server can return empty array instead of object, for example:</p>
  
  <pre><code>personal: [] //when it is empty
  </code></pre>
  
  <p>or</p>
  
  <pre><code>personal: {
  religion: 'Нет',
  smoking: 1,
  alcohol: 4
  } //when not empty.
  </code></pre>
  
  <p>I`m deserializing most of json with JsonConvert.DeserializeObject, and this part of json with </p>
  
  <pre><code>MainObject = ((MainObject["response"].GetObject())["user"].GetObject())["personal"].GetObject();
  try
  {
  Convert.ToByte(MainObject["political"].GetNumber();
  } 
  catch {}
  </code></pre>
  
  <p>But it makes app works slowly when it`s handling a lot of exeptions. And just now i realised that here are some more fields that might return array when empty. I just have no ideas how to make it fastly and clearly. Any suggestions?</p>
  
  <p>My deserializing class (doen`t work when field is empty):</p>
  
  <pre><code>     public class User
              {
  //some other fields...
                  public Personal personal { get; set; }
  //some other fields...
               }
      public class Personal
              {
                  public byte political { get; set; }
                  public string[] langs { get; set; }
                  public string religion { get; set; }
                  public string inspired_by { get; set; }
                  public byte people_main { get; set; }
                  public byte life_main { get; set; }
                  public byte smoking { get; set; }
                  public byte alcohol { get; set; }
              }
  </code></pre>
  
  <p>Another idea (doesn`t work when not empty):</p>
  
  <pre><code>public List&lt;Personal&gt; personal { get; set; }
  </code></pre>