title: How to preserve hasOwnProperty on JSON.parsed responseText?
body: <p>I am a very new developer working on a very simple application as part of my training process - so be gentle.</p>
  
  <p>I have built a function in javascript that accepts arbitrary objects from elsewhere and builds a legal POST request string.</p>
  
  <p>Code:</p>
  
  <pre><code>    function postify(oPost){
      var out = '';
      for (key in oPost){
          if (oPost.hasOwnProperty(key) &amp;&amp; key &gt;0){
              if(oPost[key].value != 'Submit'){
                  out += '&amp;' + oPost[key].name + '=' + oPost[key].value;
              }
          }
      }
      return out;
  }
  </code></pre>
  
  <p>There are many like it, but this one is mine. I elected to use hasOwnProperty as a conditional, as the total list of inherited properties could be really quite long.</p>
  
  <p>One of the objects I would like to pass to this function is a JSON parsed responseText object, which is retrieved like so. </p>
  
  <pre><code>function postData(str){
          var http = new XMLHttpRequest();
          http.open('POST', 'test.php',false);
          http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
          http.setRequestHeader("Content-length", str.length);
          http.setRequestHeader("Connection", "close");
          http.send(str);
          var response = JSON.parse(http.responseText);
          responseHandle(response);
      }
  </code></pre>
  
  <p>So, the problem - both of these functions do exactly what they are supposed to do, until my responseHandle function routes the response object to the postify function. Manual checking indicates that all expected properties are in place, but <code>postify()</code> won't concatenate a string because those properties seem to have been inherited.</p>
  
  <p>I am fully aware that I could trivially brute force assign all necessary properties - the handler function would do what it needed to either way. I am also aware that my synchronous <code>XMLHttpRequest</code> is deprecated - right this second, it's what I need, and works fine.</p>
  
  <p>So, then, some questions - is there a way to pass my JSON.parsed object such that <code>hasOwnProperty() == true</code> is maintained? Is there a different property or technique I could or should be using in <code>postify()</code> to look for deliberately set key value pairs? Should I just rig the POST to transmit ALL of the inherited properties of the object I am POSTING to PHP?</p>