Deserialize JSON when type can be different
问题 I`m working with VK API. Sometimes server can return empty array instead of object, for example: personal: [] //when it is empty or personal: { religion: 'Нет', smoking: 1, alcohol: 4 } //when not empty. I`m deserializing most of json with JsonConvert.DeserializeObject, and this part of json with MainObject = ((MainObject["response"].GetObject())["user"].GetObject())["personal"].GetObject(); try { Convert.ToByte(MainObject["political"].GetNumber(); } catch {} But it makes app works slowly