title: Get difference between 2 JSON object using javascript/JQuery
body: <p>I have 2 Json's object (this is an exemple, my object can have array in array in object, etc....):</p>
  
  <pre><code>var obj = jQuery.parseJSON('{
      "name" : "John",
      "lastname" : "Doe",
      "birthday" : "05/20/1980",
      "fav_game" : [
          "tetris",
          "tic tac toe"
      ],
      "best_friends" : {
          "name" : "Jane",
          "lastname" : "Murdoc"
      }
  }');
  
  var obj2 = jQuery.parseJSON('{
      "name" : "John",
      "lastname" : "Doe_update",
      "birthday" : "05/20/1980",
      "fav_game" : [
          "tetris",
          "tic tac toe_update"
      ],
      "best_friends" : {
          "name" : "Jane",
          "lastname" : "Murdoc",
          "new_prop" : "update"
      }
  }');
  </code></pre>
  
  <p>I would like get a difference between this 2 object for create a new one :</p>
  
  <pre><code>var obj3 = diff(obj, obj2);
  </code></pre>
  
  <p>Obj3 should looks like it :</p>
  
  <pre><code>{
      "lastname" : "Doe_update",
      "fav_game": [
          null, 
          "tic tac toe_update"
      ],
      "best_friends" : {
          "new_prop" : "update"
      }
  }
  </code></pre>
  
  <p>I found a script and i'm trying to modificate it for my need, but i'm not good enougth :</p>
  
  <pre><code>function filter(obj1, obj2) {
      var result = {};
      for(key in obj1) {
  
          if(obj2[key] != obj1[key]) {
  
              result[key] = obj2[key];
  
          }
          if(typeof obj2[key] == 'array' &amp;&amp; typeof obj1[key] == 'array') {
              result[key] = arguments.callee(obj1[key], obj2[key]);
  
          }
          if(typeof obj2[key] == 'object' &amp;&amp; typeof obj1[key] == 'object') {
              result[key] = arguments.callee(obj1[key], obj2[key]);
  
          }
      }
  return result;
  }
  </code></pre>
  
  <p>And the result using the script is : </p>
  
  <pre><code>{
      "lastname" : "Doe_update",
      "fav_game": [
          null, 
          "tic tac toe_update"
      ],
      "best_friends" : {
      }
  }
  </code></pre>
  
  <p>I need to deal with added value...</p>
  
  <p>I see many things by searching, but never the same thing of what i need.
  Sorry for my low level english, update are welcome. Thanks you guys ! </p>