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

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

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

    2. <tfoot id='vfPcd'></tfoot>

      使用 Json.net 反序列化 JSON 對象數(shù)組

      Deserializing JSON Object Array with Json.net(使用 Json.net 反序列化 JSON 對象數(shù)組)
        <tbody id='9OK4f'></tbody>

        <bdo id='9OK4f'></bdo><ul id='9OK4f'></ul>

        <tfoot id='9OK4f'></tfoot>
        1. <small id='9OK4f'></small><noframes id='9OK4f'>

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

              1. 本文介紹了使用 Json.net 反序列化 JSON 對象數(shù)組的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                問題描述

                我正在嘗試使用一個 API,該 API 使用以下示例結(jié)構(gòu)來返回其返回的 json

                I am attempt to use an API that use the follow example structure for their returned json

                [
                   {
                      "customer":{
                         "first_name":"Test",
                         "last_name":"Account",
                         "email":"test1@example.com",
                         "organization":"",
                         "reference":null,
                         "id":3545134,
                         "created_at":"2013-08-06T15:51:15-04:00",
                         "updated_at":"2013-08-06T15:51:15-04:00",
                         "address":"",
                         "address_2":"",
                         "city":"",
                         "state":"",
                         "zip":"",
                         "country":"",
                         "phone":""
                      }
                   },
                   {
                      "customer":{
                         "first_name":"Test",
                         "last_name":"Account2",
                         "email":"test2@example.com",
                         "organization":"",
                         "reference":null,
                         "id":3570462,
                         "created_at":"2013-08-12T11:54:58-04:00",
                         "updated_at":"2013-08-12T11:54:58-04:00",
                         "address":"",
                         "address_2":"",
                         "city":"",
                         "state":"",
                         "zip":"",
                         "country":"",
                         "phone":""
                      }
                   }
                ]
                

                JSON.net 可以很好地使用類似以下結(jié)構(gòu)的東西

                JSON.net would work great with something like the following structure

                {
                    "customer": {
                        ["field1" : "value", etc...],
                        ["field1" : "value", etc...],
                    }
                }
                

                但我不知道如何讓它對提供的結(jié)構(gòu)感到滿意.

                But I can not figure out how to get it to be happy with the provided structure.

                使用默認的 JsonConvert.DeserializeObject(content) 得到正確數(shù)量的客戶,但所有數(shù)據(jù)為空.

                Using the default JsonConvert.DeserializeObject(content) results the correct number of Customer but all of the data is null.

                對 CustomerList(如下)執(zhí)行操作會導(dǎo)致無法反序列化當前 JSON 數(shù)組"異常

                Doing something a CustomerList (below) results in a "Cannot deserialize the current JSON array" exception

                public class CustomerList
                {
                    public List<Customer> customer { get; set; }
                }
                

                想法?

                推薦答案

                您可以創(chuàng)建一個新模型來反序列化您的 JSON CustomerJson:

                You can create a new model to Deserialize your JSON CustomerJson:

                    public class CustomerJson
                    {
                        [JsonProperty("customer")]
                        public Customer Customer { get; set; }
                    }
                
                    public class Customer
                    {
                        [JsonProperty("first_name")]
                        public string Firstname { get; set; }
                
                        [JsonProperty("last_name")]
                        public string Lastname { get; set; }
                
                        ...
                    }
                

                您可以輕松地反序列化您的 JSON:

                And you can deserialize your JSON easily:

                JsonConvert.DeserializeObject<List<CustomerJson>>(json);
                

                文檔:序列化和反序列化 JSON

                這篇關(guān)于使用 Json.net 反序列化 JSON 對象數(shù)組的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                相關(guān)文檔推薦

                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)
                <tfoot id='LSjr1'></tfoot>
              2. <i id='LSjr1'><tr id='LSjr1'><dt id='LSjr1'><q id='LSjr1'><span id='LSjr1'><b id='LSjr1'><form id='LSjr1'><ins id='LSjr1'></ins><ul id='LSjr1'></ul><sub id='LSjr1'></sub></form><legend id='LSjr1'></legend><bdo id='LSjr1'><pre id='LSjr1'><center id='LSjr1'></center></pre></bdo></b><th id='LSjr1'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='LSjr1'><tfoot id='LSjr1'></tfoot><dl id='LSjr1'><fieldset id='LSjr1'></fieldset></dl></div>
                  <tbody id='LSjr1'></tbody>

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

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

                    <bdo id='LSjr1'></bdo><ul id='LSjr1'></ul>

                        1. 主站蜘蛛池模板: 国产不卡在线观看 | 日韩福利在线观看 | 九九在线视频 | 亚洲在线 | 成人午夜视频在线观看 | 瑟瑟激情| 亚洲成年影院 | 男女下面一进一出网站 | 国产精品福利久久久 | 最新中文字幕久久 | 精品一二区 | 狠狠艹| 亚洲永久在线 | 国产精品成人一区二区三区夜夜夜 | 污污免费网站 | 亚洲欧洲色视频 | 久久久www成人免费精品 | 日韩中文欧美 | 日韩欧美在线免费观看 | 国产精品久久久久免费 | 精品国产18久久久久久二百 | 在线区| 成人亚洲在线 | 欧美理论| 久久性av| 丝袜美腿一区二区三区 | 国产一区二区三区不卡av | 韩国精品一区二区三区 | 亚洲一区二区久久 | 国产乱码精品一区二区三区五月婷 | 中文字幕乱码一区二区三区 | 一级黄色片日本 | 超碰伊人 | 欧洲亚洲一区 | 国产黄色在线观看 | 亚洲欧美在线视频 | 日韩在线观看视频一区 | av黄色在线 | 日韩精品在线看 | 午夜影院黄 | 免费av观看 |