title: How to merge json array with same values in javascript
body: <p>I have two array and i want to merge the data with the same value of</p>
  
  <p><code>"calleridnum":"0090000163",</code>
  <code>"uid":"0090000163",</code></p>
  
  <p>this is my first array: </p>
  
  <pre><code>[
  {
  "_id":"55d44fe38879f12e6431c23c",
  "event":"ConfbridgeJoin",
  "channel":"SIP/peer_voip301confbridge-00000145",
  "uniqueid":"1439977429.777",
  "conference":"0090000167",
  "calleridnum":"0090000163",
  "calleridname":"0090000163",
  "__v":0,
  "sipSetting":{
  "accountcode":"",
  "accountcode_naisen":"202",
  "extentype":0,
  "extenrealname":"",
  "name":"0090000163",
  "secret":"Myojyo42f!",
  "username":"0090000163",
  "context":"innercall_xdigit",
  "gid":101,
  "cid":"0090000007"
  }
  }
  ]
  </code></pre>
  
  
  
  <p>This is my second array</p>
  
  <pre><code>[
  {
  "id":8,
  "uid":"0090000163",
  "cid":"0090000007",
  "extension":"202",
  "secret":"Myojyo42f!",
  "leader":true,
  "simultaneous":false,
  "confbridge_id":6,
  "created_at":"2015-08-18 09:22:20",
  "updated_at":"2015-08-18 09:22:20"
  },
  {
  "id":15,
  "uid":"0090000164",
  "cid":"0090000007",
  "extension":"203",
  "secret":"Myojyo42f!",
  "leader":false,
  "simultaneous":false,
  "confbridge_id":6,
  "created_at":"2015-08-19 01:26:30",
  "updated_at":"2015-08-19 01:26:30"
  }
  ]
  </code></pre>
  
  <p>i want to merge the object with the same value of 0090000163</p>
  
  <p>i want to get if calleridnum == uid</p>
  
  <p>i want to get this output</p>
  
  
  
  <pre class="lang-js prettyprint-override"><code>"_id":"55d44fe38879f12e6431c23c",
      "event":"ConfbridgeJoin",
      "channel":"SIP/peer_voip301confbridge-00000145",
      "uniqueid":"1439977429.777",
      "conference":"0090000167",
      "calleridnum":"0090000163",
      "calleridname":"0090000163",
      "__v":0,
      "sipSetting":{
      "accountcode":"",
      "accountcode_naisen":"202",
      "extentype":0,
      "extenrealname":"",
      "name":"0090000163",
      "secret":"Myojyo42f!",
      "username":"0090000163",
      "context":"innercall_xdigit",
      "gid":101,
      "cid":"0090000007"
      "id":8,
      "uid":"0090000163",
      "cid":"0090000007",
      "extension":"202",
      "secret":"Myojyo42f!",
      "leader":true,
      "simultaneous":false,
      "confbridge_id":6,
      "created_at":"2015-08-18 09:22:20",
      "updated_at":"2015-08-18 09:22:20"
  </code></pre>
  
  <p>i do it in php . but i dont have much knowledge in javascript</p>
  
  <p>this is my code in php</p>
  
  <pre><code>// $apiResults['participants'] == first array
  // $apiResults['conference_participants'] == second array
  
  
  $conf_participants = array();
        foreach($apiResults['participants'] as $participant)
        {
         foreach($apiResults['conference_participants'] as $conference_participant)
           {
      if($participant['calleridnum'] == $conference_participant['uid'])
          {
  
             $conf_participants['uniqueid'] = $participant['uniqueid'];
             $conf_participants['event'] = $participant['event'];
             $conf_participants['channel'] = $participant['channel'];
             $conf_participants['uid'] = $conference_participant['uid'];
  
  
  
         }
         }
        }
  </code></pre>