久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<i id='eZLDM'><tr id='eZLDM'><dt id='eZLDM'><q id='eZLDM'><span id='eZLDM'><b id='eZLDM'><form id='eZLDM'><ins id='eZLDM'></ins><ul id='eZLDM'></ul><sub id='eZLDM'></sub></form><legend id='eZLDM'></legend><bdo id='eZLDM'><pre id='eZLDM'><center id='eZLDM'></center></pre></bdo></b><th id='eZLDM'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='eZLDM'><tfoot id='eZLDM'></tfoot><dl id='eZLDM'><fieldset id='eZLDM'></fieldset></dl></div>
    1. <tfoot id='eZLDM'></tfoot>
    2. <legend id='eZLDM'><style id='eZLDM'><dir id='eZLDM'><q id='eZLDM'></q></dir></style></legend>

          <bdo id='eZLDM'></bdo><ul id='eZLDM'></ul>
      1. <small id='eZLDM'></small><noframes id='eZLDM'>

        無法將 JSON 數組(例如 [1,2,3])反序列化為類型“

        Cannot deserialize the JSON array (e.g. [1,2,3]) into type #39; #39; because type requires JSON object (e.g. {quot;namequot;:quot;valuequot;}) to deserialize correctly(無法將 JSON 數組(例如 [1,2,3])反序列化為類型“,因為類型
        <tfoot id='rGCgz'></tfoot>
          <tbody id='rGCgz'></tbody>
          <bdo id='rGCgz'></bdo><ul id='rGCgz'></ul>
              <i id='rGCgz'><tr id='rGCgz'><dt id='rGCgz'><q id='rGCgz'><span id='rGCgz'><b id='rGCgz'><form id='rGCgz'><ins id='rGCgz'></ins><ul id='rGCgz'></ul><sub id='rGCgz'></sub></form><legend id='rGCgz'></legend><bdo id='rGCgz'><pre id='rGCgz'><center id='rGCgz'></center></pre></bdo></b><th id='rGCgz'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='rGCgz'><tfoot id='rGCgz'></tfoot><dl id='rGCgz'><fieldset id='rGCgz'></fieldset></dl></div>

            1. <small id='rGCgz'></small><noframes id='rGCgz'>

              <legend id='rGCgz'><style id='rGCgz'><dir id='rGCgz'><q id='rGCgz'></q></dir></style></legend>

                  本文介紹了無法將 JSON 數組(例如 [1,2,3])反序列化為類型“",因為類型需要 JSON 對象(例如 {“name":“value"})才能正確反序列化的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我有這個 JSON:

                  [
                      {
                          "Attributes": [
                              {
                                  "Key": "Name",
                                  "Value": {
                                      "Value": "Acc 1",
                                      "Values": [
                                          "Acc 1"
                                      ]
                                  }
                              },
                              {
                                  "Key": "Id",
                                  "Value": {
                                      "Value": "1",
                                      "Values": [
                                          "1"
                                      ]
                                  }
                              }
                          ],
                          "Name": "account",
                          "Id": "1"
                      },
                      {
                          "Attributes": [
                              {
                                  "Key": "Name",
                                  "Value": {
                                      "Value": "Acc 2",
                                      "Values": [
                                          "Acc 2"
                                      ]
                                  }
                              },
                              {
                                  "Key": "Id",
                                  "Value": {
                                      "Value": "2",
                                      "Values": [
                                          "2"
                                      ]
                                  }
                              }
                          ],
                          "Name": "account",
                          "Id": "2"
                      },
                      {
                          "Attributes": [
                              {
                                  "Key": "Name",
                                  "Value": {
                                      "Value": "Acc 3",
                                      "Values": [
                                          "Acc 3"
                                      ]
                                  }
                              },
                              {
                                  "Key": "Id",
                                  "Value": {
                                      "Value": "3",
                                      "Values": [
                                          "3"
                                      ]
                                  }
                              }
                          ],
                          "Name": "account",
                          "Id": "2"
                      }
                  ]
                  

                  我有這些課程:

                  public class RetrieveMultipleResponse
                  {
                      public List<Attribute> Attributes { get; set; }
                      public string Name { get; set; }
                      public string Id { get; set; }
                  }
                  
                  public class Value
                  {
                      [JsonProperty("Value")]
                      public string value { get; set; }
                      public List<string> Values { get; set; }
                  }
                  
                  public class Attribute
                  {
                      public string Key { get; set; }
                      public Value Value { get; set; }
                  }
                  

                  我正在嘗試使用以下代碼反序列化上述 JSON:

                  I am trying to deserialize the above JSON using the code below:

                  var objResponse1 = JsonConvert.DeserializeObject<RetrieveMultipleResponse>(JsonStr);
                  

                  但我收到此錯誤:

                  無法將當前 JSON 數組(例如 [1,2,3])反序列化為類型'test.Model.RetrieveMultipleResponse' 因為該類型需要 JSON對象(例如 {"name":"value"})正確反序列化.要解決這個問題錯誤要么將 JSON 更改為 JSON 對象(例如 {"name":"value"})或將反序列化類型更改為數組或實現的類型一個集合接口(例如 ICollection、IList),比如 List 可以從 JSON 數組反序列化.JsonArrayAttribute 也可以添加到類型以強制它從 JSON 數組反序列化.小路'',第 1 行,位置 1.

                  Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'test.Model.RetrieveMultipleResponse' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly. To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array. Path '', line 1, position 1.

                  推薦答案

                  您的 json 字符串包含在方括號 ([]) 中,因此它被解釋為數組而不是單個 RetrieveMultipleResponse 對象.因此,您需要將其反序列化為 RetrieveMultipleResponse 的類型集合,例如:

                  Your json string is wrapped within square brackets ([]), hence it is interpreted as array instead of single RetrieveMultipleResponse object. Therefore, you need to deserialize it to type collection of RetrieveMultipleResponse, for example :

                  var objResponse1 = 
                      JsonConvert.DeserializeObject<List<RetrieveMultipleResponse>>(JsonStr);
                  

                  這篇關于無法將 JSON 數組(例如 [1,2,3])反序列化為類型“",因為類型需要 JSON 對象(例如 {“name":“value"})才能正確反序列化的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Ignore whitespace while reading XML(讀取 XML 時忽略空格)
                  XML to LINQ with Checking Null Elements(帶有檢查空元素的 XML 到 LINQ)
                  Reading XML with unclosed tags in C#(在 C# 中讀取帶有未閉合標簽的 XML)
                  Parsing tables, cells with Html agility in C#(在 C# 中使用 Html 敏捷性解析表格、單元格)
                  delete element from xml using LINQ(使用 LINQ 從 xml 中刪除元素)
                  Parse malformed XML(解析格式錯誤的 XML)

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

                      • <tfoot id='r7GPF'></tfoot>
                            <tbody id='r7GPF'></tbody>

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

                        1. <legend id='r7GPF'><style id='r7GPF'><dir id='r7GPF'><q id='r7GPF'></q></dir></style></legend>
                          • 主站蜘蛛池模板: 国产日产精品一区二区三区的介绍 | 99re这里只有精品6 | 国产毛片一级 | 国产精品日韩在线 | 中文字幕精品在线 | 一区二区三区日韩 | 黄色片aaa| 国产精品一区二区在线播放 | 色哟哟一区二区三区 | 五月婷婷六月丁香 | 国产又粗又猛视频免费 | 成人免费在线视频观看 | 久久久久久久久国产 | 日韩爱爱视频 | 长河落日| 欧美性色网 | 精品久久久久久久久久久 | 干少妇视频 | 国产高清在线观看 | 色77777| 国产精品一区二区在线免费观看 | 午夜性福利 | 两性午夜视频 | 日本三级韩国三级美三级91 | 亚洲欧美在线视频 | 亚洲成人精品一区 | 伊人久久av | 91tv国产成人福利 | 国产香蕉av | 一级毛片网 | 久久久黄色 | 日韩精品在线视频 | 免费的av| 性视频网| 亚洲天堂免费 | 日韩第一区 | 国产黄色av网站 | 亚洲视频一区在线观看 | 日韩激情一区二区 | 日韩av在线免费 | 一级黄色性生活片 |