• <legend id='xDyvR'><style id='xDyvR'><dir id='xDyvR'><q id='xDyvR'></q></dir></style></legend>

    <small id='xDyvR'></small><noframes id='xDyvR'>

        • <bdo id='xDyvR'></bdo><ul id='xDyvR'></ul>
        <tfoot id='xDyvR'></tfoot>
        <i id='xDyvR'><tr id='xDyvR'><dt id='xDyvR'><q id='xDyvR'><span id='xDyvR'><b id='xDyvR'><form id='xDyvR'><ins id='xDyvR'></ins><ul id='xDyvR'></ul><sub id='xDyvR'></sub></form><legend id='xDyvR'></legend><bdo id='xDyvR'><pre id='xDyvR'><center id='xDyvR'></center></pre></bdo></b><th id='xDyvR'></th></span></q></dt></tr></i><div id='xDyvR'><tfoot id='xDyvR'></tfoot><dl id='xDyvR'><fieldset id='xDyvR'></fieldset></dl></div>

        如何反序列化时间戳本身包含字段的JSON数据?

        时间:2023-05-23

              <tbody id='km4Zm'></tbody>

                <i id='km4Zm'><tr id='km4Zm'><dt id='km4Zm'><q id='km4Zm'><span id='km4Zm'><b id='km4Zm'><form id='km4Zm'><ins id='km4Zm'></ins><ul id='km4Zm'></ul><sub id='km4Zm'></sub></form><legend id='km4Zm'></legend><bdo id='km4Zm'><pre id='km4Zm'><center id='km4Zm'></center></pre></bdo></b><th id='km4Zm'></th></span></q></dt></tr></i><div id='km4Zm'><tfoot id='km4Zm'></tfoot><dl id='km4Zm'><fieldset id='km4Zm'></fieldset></dl></div>

              • <tfoot id='km4Zm'></tfoot>
              • <small id='km4Zm'></small><noframes id='km4Zm'>

                <legend id='km4Zm'><style id='km4Zm'><dir id='km4Zm'><q id='km4Zm'></q></dir></style></legend>
                • <bdo id='km4Zm'></bdo><ul id='km4Zm'></ul>

                  本文介绍了如何反序列化时间戳本身包含字段的JSON数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我无法使用给定的 JSON 数据映射类:

                  I am Unable to map the class with the given JSON data:

                  {
                      "Meta Data": {
                          "1. Information": "Intraday (15min) open, high, low, close prices and volume",
                          "2. Symbol": "MSFT",
                          "3. Last Refreshed": "2018-09-28 15:45:00",
                          "4. Interval": "15min",
                          "5. Output Size": "Full size",
                          "6. Time Zone": "US/Eastern"
                      },
                      "Time Series (15min)": {
                          "2018-09-28 15:45:00": {
                              "1. open": "114.2800",
                              "2. high": "114.5600",
                              "3. low": "114.2400",
                              "4. close": "114.4800",
                              "5. volume": "2316251"
                          },
                          "2018-09-28 15:30:00": {
                              "1. open": "114.4450",
                              "2. high": "114.4500",
                              "3. low": "114.2600",
                              "4. close": "114.2900",
                              "5. volume": "759991"
                          },
                          "2018-09-28 15:15:00": {
                              "1. open": "114.3550",
                              "2. high": "114.5200",
                              "3. low": "114.3100",
                              "4. close": "114.4400",
                              "5. volume": "515174"
                          }
                      }
                  }
                  

                  如何创建类结构结构,以便我可以在 c# 中使用 newtonsoft 对上述数据进行反序列化?

                  How to create class structure structure so that i can de-serialize the above data using newtonsoft in c#?

                  推荐答案

                  借助Quicktype 和一些编辑,我创建了这些类:

                  Using the help of Quicktype and a bit of editing, I created these classes:

                  public class RootObject
                  {
                      [JsonProperty("Meta Data")]
                      public MetaData MetaData { get; set; }
                  
                      [JsonProperty("Time Series (15min)")]
                      public Dictionary<DateTime, TimeSeriesItem> TimeSeries15Min { get; set; }
                  }
                  
                  public class MetaData
                  {
                      [JsonProperty("1. Information")]
                      public string The1Information { get; set; }
                  
                      [JsonProperty("2. Symbol")]
                      public string The2Symbol { get; set; }
                  
                      [JsonProperty("3. Last Refreshed")]
                      public DateTimeOffset The3LastRefreshed { get; set; }
                  
                      [JsonProperty("4. Interval")]
                      public string The4Interval { get; set; }
                  
                      [JsonProperty("5. Output Size")]
                      public string The5OutputSize { get; set; }
                  
                      [JsonProperty("6. Time Zone")]
                      public string The6TimeZone { get; set; }
                  }
                  
                  public class TimeSeriesItem
                  {
                      [JsonProperty("1. open")]
                      public string The1Open { get; set; }
                  
                      [JsonProperty("2. high")]
                      public string The2High { get; set; }
                  
                      [JsonProperty("3. low")]
                      public string The3Low { get; set; }
                  
                      [JsonProperty("4. close")]
                      public string The4Close { get; set; }
                  
                      [JsonProperty("5. volume")]
                      public long The5Volume { get; set; }
                  }
                  

                  你可以像这样反序列化它:

                  You can deserialize it like so:

                  var data = Newtonsoft.Json.JsonConvert.DeserializeObject<RootObject>(json);
                  

                  在线试用

                  这篇关于如何反序列化时间戳本身包含字段的JSON数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:JSON.Net 自定义合约序列化和集合 下一篇:如何反序列化 JSONP 响应(最好使用 JsonTextReader 而不是字符串)?

                  相关文章

                    <tfoot id='o0yAg'></tfoot>
                    • <bdo id='o0yAg'></bdo><ul id='o0yAg'></ul>

                    1. <legend id='o0yAg'><style id='o0yAg'><dir id='o0yAg'><q id='o0yAg'></q></dir></style></legend>

                      <i id='o0yAg'><tr id='o0yAg'><dt id='o0yAg'><q id='o0yAg'><span id='o0yAg'><b id='o0yAg'><form id='o0yAg'><ins id='o0yAg'></ins><ul id='o0yAg'></ul><sub id='o0yAg'></sub></form><legend id='o0yAg'></legend><bdo id='o0yAg'><pre id='o0yAg'><center id='o0yAg'></center></pre></bdo></b><th id='o0yAg'></th></span></q></dt></tr></i><div id='o0yAg'><tfoot id='o0yAg'></tfoot><dl id='o0yAg'><fieldset id='o0yAg'></fieldset></dl></div>

                      <small id='o0yAg'></small><noframes id='o0yAg'>