title: Remove duplicates and merge JSON objects
body: <p>I have the following JSON object. I need to remove the duplicates and merge the inner object using plain Javascript. How do I go about doing this?</p>
  
  <pre><code>[{
      "id" : 1,
      "name" : "abc",
      "nodes" :[
          {
              "nodeId" : 20,
              "nodeName" : "test1"
          }
      ]
  },
  {
      "id" : 1,
      "name" : "abc",
      "nodes" :[
          {
              "nodeId" : 21,
              "nodeName" : "test2"
          }
      ]
  }]
  </code></pre>
  
  <p>Following is the object that I expect as output.</p>
  
  <pre><code>[{
      "id" : 1,
      "name" : "abc",
      "nodes" :[
          {
              "nodeId" : 20,
              "nodeName" : "test1"
          },
          {
              "nodeId" : 21,
              "nodeName" : "test2"
          },
      ]
  }]
  </code></pre>
  
  <p>Regards.</p>
  
  <p>Shreerang</p>