title: How to update property value in JSON string?
body: <p>Below is my JSON:</p>
  
  <pre><code>[
    {
      "name": "Node-1",
      "flag": true,
      "myObj": {
        region: {
          info: {
            name: null,
            infoFlag: false,
  
          }
        }
      },
      "nodes": [
        {
          "name": "Node-1-1",
          "flag": true,
          "myObj": {
            region: {
              info: {
                name: "abc",
                infoFlag: false,
  
              }
            }
          },
          "nodes": [
            {
              "name": "Node-1-1-1",
              "flag": true,
              "myObj": {
                region: {
                  info: {
                    name: "xyz",
                    infoFlag: false,
  
                  }
                }
              },
              "nodes": [
  
              ]
            }
          ]
        }
      ]
    }
  ]
  </code></pre>
  
  <p>I want to update two properties of my above JSON string with following rule :</p>
  
  <p><strong>Flag :</strong> I want to blindly update this property to <code>false</code>.</p>
  
  <p><strong>infoFlag:</strong> If <code>name</code> property of <code>info</code> is <code>null</code> then I want to update <code>infoFlag</code> to <code>true</code> else <code>false</code> if it is <code>not null</code>.</p>
  
  <p>So after updating my JSON with these rules I want to have that JSON as a string.</p>
  
  <p><strong>Note:</strong> I don't want to deserialize and then update property based on above two rules as because my JSON has lots of properties for which I don't want to create classes, so I am looking for something which will work without deserializing with class.</p>
  
  <p>This is how I am trying to do it:</p>
  
  <pre><code>string json = "MyJson";
  var temp =  JArray.Parse(json);
  temp.Descendants()
      .OfType&lt;JProperty&gt;()
  json = temp.ToString();
  </code></pre>
  
  <p>But here I am not getting as how to traverse my JSON recursively; as you can see I have recursive structure like below :</p>
  
  <pre><code>Node-1
      Node-1-1
         Node-1-1-1
  </code></pre>