var url = "http://wthrcdn.etouch.cn/WeatherApi?city=" + HttpUtility.UrlDecode(city);
            var client = this.httpClientFactory.CreateClient(nameof(HttpClient));
            var response = await client.GetAsync(url);
            var xml = await response.Content.ReadAsStringAsync();
            XmlDocument doc = new XmlDocument();
            xml = Regex.Replace(xml, @"<\?xml*.*?>", "", RegexOptions.IgnoreCase);
            doc.LoadXml(xml);
            string jsonText = JsonConvert.SerializeXmlNode(doc);
            var jsonObj = JsonConvert.DeserializeObject<dynamic>(jsonText);

 

相关文章:

  • 2021-09-14
  • 2021-09-23
  • 2022-12-23
  • 2021-11-10
  • 2022-12-23
猜你喜欢
  • 2021-06-19
  • 2022-12-23
  • 2021-11-16
  • 2021-11-13
  • 2022-01-12
  • 2022-12-23
  • 2021-12-05
相关资源
相似解决方案