亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

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

使用鍵將嵌套的 JObject 反序列化為 List

使用鍵將嵌套的 JObject 反序列化為 List

C#
函數式編程 2021-06-04 10:37:28
我需要使用 Newtonsoft.Json 將 json 反序列化回對象實例。但是,它是一個列表類型對象,條目的鍵對我很有用。我不知道如何在不手動一一映射字段的情況下自動反序列化。這是回應:{    coins: {        365Coin: {            id: 74,            tag: "365",            algorithm: "Keccak",            lagging: true,            listed: false,            status: "No available stats",            testing: false        },        Aiden: {            id: 65,            tag: "ADN",            algorithm: "Scrypt-OG",            lagging: true,            listed: false,            status: "No available stats",            testing: false        },        Adzcoin: {            id: 157,            tag: "ADZ",            algorithm: "X11",            lagging: false,            listed: false,            status: "Active",            testing: false        }        ... [With various key representing the name of coins]    }}完整回復:https : //whattomine.com/calculators.json我對這門課的最佳猜測是:internal class WhatToMineCalculatorsResponse{    // Should be Dictionary???    [JsonProperty("coins")]    public IList<WhatToMineCalculatorResponse> Coins { get; set; }}internal class WhatToMineCalculatorResponse{    // I want the key set in this field    public string Name { get; set; }    [JsonProperty("id")]    public int Id { get; set; }    [JsonProperty("tag")]    public string Symbol { get; set; }    [JsonProperty("status")]    public string Status { get; set; }    [JsonProperty("algorithm")]    public string Algo { get; set; }    [JsonProperty("listed")]    public bool IsListed { get; set; }}請注意,我希望將鍵包含在我的類中,但不希望作為字典的鍵。以后很難找回密鑰。
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 574 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號