第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何反序列化 JSON 并在 C# 中獲取值

如何反序列化 JSON 并在 C# 中獲取值

C#
開心每一天1111 2021-10-09 16:09:52
// Get the JSON response.                    string contentString = await response.Content.ReadAsStringAsync();                    Console.WriteLine(contentString);                    var rs = Newtonsoft.Json.Linq.JToken.Parse(contentString); Result rst = JsonConvert.DeserializeObject<Result>(contentString);//Here i need to get the first value in the description as it appears to be a listvar firstValue= rst.description;//And also a value from captionvar captionValue = rst.Caption public class Result    {        public Category[] categories { get; set; }        public Description description { get; set; }        public string requestId { get; set; }        public  Caption caption { get; set;}        public Metadata metadata { get; set; }        public Color color { get; set; }    }    public class Description    {        public string[] tags { get; set; }        public Caption[] captions { get; set; }    }    public class Caption    {        public string text { get; set; }        public float confidence { get; set; }    }    public class Metadata    {        public int width { get; set; }        public int height { get; set; }        public string format { get; set; }    }    public class Color    {        public string dominantColorForeground { get; set; }        public string dominantColorBackground { get; set; }        public string[] dominantColors { get; set; }        public string accentColor { get; set; }        public bool isBWImg { get; set; }    }    public class Category    {        public string name { get; set; }        public float score { get; set; }    }} 我明白我想要的很簡單,但對我來說看起來有點復雜。我已經(jīng)使用了Result //rst = JsonConvert.DeserializeObject<Result>(contentString);連接并獲取響應,我已經(jīng)傳入了 JSON 數(shù)據(jù)的 contentString。我只想得到我想要的價值。使用 description 作為示例會更有幫助。謝謝
查看完整描述

3 回答

  • 3 回答
  • 0 關(guān)注
  • 297 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號