/// <summary> /// Parses Gelbooru posts from the supplied text. /// </summary> /// <param name="text"></param> /// <returns></returns> private static List <Model> ParseGelbooruPosts(string text) { var posts = JObject.Parse(JsonUtils.ConvertXmlToJson(text))["posts"]; var count = posts["count"].ToObject <int>(); return(count == 1 ? new List <Model> { posts["post"].ToObject <Model>() } : posts["post"].ToObject <List <Model> >()); }