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

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

        <tfoot id='VWpZc'></tfoot>

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

      2. 如何使用 NewtonSoft 更新 JSON 對象的屬性

        How to update a property of a JSON object using NewtonSoft(如何使用 NewtonSoft 更新 JSON 對象的屬性)

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

                1. <tfoot id='tXASc'></tfoot>

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

                2. <legend id='tXASc'><style id='tXASc'><dir id='tXASc'><q id='tXASc'></q></dir></style></legend>

                3. 本文介紹了如何使用 NewtonSoft 更新 JSON 對象的屬性的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我有一個這樣的 JSON 字符串:

                  I have a JSON string like this:

                  {
                      "code": "GENDER",
                      "value": { "option": "ML" }
                  }
                  

                  如果值為 "ML""Female",我想將 option 屬性更新為 "Male" 如果值為 "FM".

                  I would like to update the option property to "Male" if the value is "ML" and "Female" if the value is "FM".

                  我已經到了這一點,但不確定如何繼續:

                  I have got to this point, but am unsure how to proceed:

                  JArray contentobject = (JArray)JsonConvert.DeserializeObject(contentJSON);  
                  JObject voicgObj = contentobject.Children().FirstOrDefault(ce =>   ce["code"].ToString() == "GENDER") as JObject;
                  JProperty voicgProp = voicgObj.Property("value");
                  

                  我不知道如何訪問 option,它是 value 的子項.

                  I don't know how to get to the option which is a child of value.

                  提前致謝.任何指針都會很棒.

                  Thanks in advance. Any pointers would be great.

                  推薦答案

                  可以通過屬性作為鍵來訪問對象:

                  You can access the object by using properties as keys:

                  JObject obj = JObject.Parse(json);
                  string gender = (string)obj["value"]["option"];
                  

                  對于您的示例,請嘗試:

                  For your example, try:

                  JObject obj = JObject.Parse(json);
                  var val = obj["value"];
                  string option = (string)val["option"];
                  
                  if (option == "ML")
                     val["option"] = "Male";
                  
                  if (option == "FM")
                     val["option"] = "Female";
                  
                  string result = obj.ToString();
                  

                  這篇關于如何使用 NewtonSoft 更新 JSON 對象的屬性的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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)
                  <tfoot id='JRq3e'></tfoot>

                    <legend id='JRq3e'><style id='JRq3e'><dir id='JRq3e'><q id='JRq3e'></q></dir></style></legend>
                    • <small id='JRq3e'></small><noframes id='JRq3e'>

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

                        • <bdo id='JRq3e'></bdo><ul id='JRq3e'></ul>
                            主站蜘蛛池模板: 狠狠干美女 | 男女羞羞视频免费看 | 国产麻豆乱码精品一区二区三区 | 中文字幕在线观看 | 成人视屏在线观看 | 最新免费视频 | 国产精品久久久久久久久久尿 | 久久国产精品99久久久大便 | 国产欧美一区二区三区在线播放 | 成人精品一区二区三区 | 欧美日韩在线看 | 国产成人精品高清久久 | 天天综合网天天综合色 | 亚洲视频在线一区 | 欧美激情在线播放 | 日韩精品一区二区三区在线播放 | 日日夜夜精品免费视频 | 久久国产区 | 九九视频在线观看 | 久久久亚洲精品视频 | 羞羞视频网站 | 在线视频一区二区 | 国产成人久久精品一区二区三区 | 成人在线免费观看视频 | 亚洲最大的黄色网址 | 中文二区 | 国产大学生情侣呻吟视频 | 中文字幕91 | 日韩欧美二区 | 欧美国产日韩在线观看成人 | 欧美色综合网 | 欧美在线一区二区三区 | 国产精品国产a级 | 欧美一二三 | 亚洲高清视频在线观看 | 一级做a| 欧美电影一区 | 亚洲欧美中文字幕在线观看 | 国产乱码久久久久久 | 91午夜在线 | 日韩二三区 |