title: Hide certain values in output from JSON.stringify()
body: <p>Is it possible to exclude certain fields from being included in the json string?</p>
  
  <p>Here is some pseudo code</p>
  
  <pre><code>var x = {
      x:0,
      y:0,
      divID:"xyz",
      privateProperty1: 'foo',
      privateProperty2: 'bar'
  }
  </code></pre>
  
  <p>I want to exclude privateProperty1 and privateproperty2 from appearing in the json string</p>
  
  <p>So I thought, I can use the stringify replacer function</p>
  
  <pre><code>function replacer(key,value)
  {
      if (key=="privateProperty1") then retun "none";
      else if (key=="privateProperty2") then retun "none";
      else return value;
  }
  </code></pre>
  
  <p>and in the stringify</p>
  
  <pre><code>var jsonString = json.stringify(x,replacer);
  </code></pre>
  
  <p>But in the jsonString I still see it as</p>
  
  <pre><code>{...privateProperty1:value..., privateProperty2:value }
  </code></pre>
  
  <p>I would like to the string without the privateproperties in them.</p>