title: Replacing values in JSON object
body: <p>I have the following JSON object <code>data</code> returned from my apicontroller :</p>
  <pre><code>[  
    {&quot;id&quot;:2,&quot;text&quot;:&quot;PROGRAMME&quot;,&quot;parent&quot;:null},
    {&quot;id&quot;:3,&quot;text&quot;:&quot;STAGE&quot;,&quot;parent&quot;:2},
    {&quot;id&quot;:4,&quot;text&quot;:&quot;INFRA&quot;,&quot;parent&quot;:2},
    {&quot;id&quot;:5,&quot;text&quot;:&quot;SYSTEM&quot;,&quot;parent&quot;:3},
    {&quot;id&quot;:6,&quot;text&quot;:&quot;STOCK&quot;,&quot;parent&quot;:3}, 
    {&quot;id&quot;:7,&quot;text&quot;:&quot;DPT&quot;,&quot;parent&quot;:3},
    {&quot;id&quot;:9,&quot;text&quot;:&quot;EXTERNAL&quot;,&quot;parent&quot;:null} 
  ]
  </code></pre>
  <p>I want to replace <code>&quot;parent&quot;:null</code> with <code>&quot;parent&quot;:'&quot;#&quot;'</code></p>
  <p>I have tried the code below, but it is only replacing the first occurrence of <code>&quot;parent&quot;:null</code>. How can I replace all <code>&quot;parent&quot;:null</code> entries?</p>
  <pre><code>$(document).ready(function () {
      $.ajax({
          url: &quot;http://localhost:37994/api/EPStructures2/&quot;,
          type: &quot;Get&quot;,
          success: function (data) {
              var old = JSON.stringify(data).replace(null, &quot;'#'&quot;); //convert to JSON string
              var new = JSON.parse(old); //convert back to array
          },
          error: function (msg) { alert(msg); }
      });
  });
  </code></pre>
  <p>Thanks,</p>