Update json value if attempt is made to same key name
<p>I'm attempting to write a function which updates a json key value if an attempt is made to add a new key with same name</p>

<p>So in fiddle - <a href="http://jsfiddle.net/adrianjsfiddlenetuser/C6Ssa/57/" rel="nofollow">http://jsfiddle.net/adrianjsfiddlenetuser/C6Ssa/57/</a></p>

<p>When the button "Add" is clicked the jSon array toUpdate should be updated : </p>

<pre><code>   name: "addThis2",
   id : 10   
</code></pre>

<p>should become </p>

<pre><code>   name: "addThis2",
   id : 11  
</code></pre>

<p>This is not occuring ?</p>

<p>Sample JSON : </p>

<pre><code>{
    "toAdd": [
        {
            "name": "addThis",
            "id": 10
        }
    ],
    "toRemove": [
        {
            "name": "removeThis"
        }
    ]
}
</code></pre>
