title: How to get the number of count including the duplicates in javascript from JSON?
body: <p>I have the JSON as following ,</p>
  
  <pre><code>var json =
           [
              {"cardAid":"ALPHG","displayName":"ALPHG","SequenceNumber":"0","port":"A"},
              {"cardAid":"ALPHG","displayName":"ALPHG","SequenceNumber":"1","port":"B"},
              {"cardAid":"SFD","displayName":"SFD","SequenceNumber":"2","port":"C"},
              {"cardAid":"SFD","displayName":"SFD","SequenceNumber":"3","port":"D"},
              {"cardAid":"ALPHG","displayName":"ALPHG","SequenceNumber":"4","port":"E"},
              {"cardAid":"ALPHG","displayName":"ALPHG","SequenceNumber":"5","port":"F"},
              {"cardAid":"BETA","displayName":"BETA","SequenceNumber":"6","port":"G"}
          ];
  </code></pre>
  
  <p>I used the code to parse this JSON from this link,
  <a href="https://stackoverflow.com/questions/25822671/to-get-the-number-of-count-from-json-in-javascript">TO Get the number of Count from JSON in javascript?</a></p>
  
  <pre><code>function count(arr) {
      var map = {};
      for (var i = 0; i &lt; arr.length; i++) {
          var name = arr[i].cardAid;
          var port = arr[i].port;
          if (name in map){
              map[name].Count++;
              map[name].Port += ',' + port;
          } else {
              map[name] = { Count: 1, Port: port };
          }
      }
      return map;
  }
  </code></pre>
  
  <p>This Function parses the JSON using cardAid as the key and gives output as,</p>
  
  <pre><code>{
    ALPHG: { Count: 4, Port: "A,B,E,F" },
    SFD: { Count: 2, Port: "C,D" },
    BETA: { Count: 1, Port: "G" }
  }
  </code></pre>
  
  <p>But i need the output based on the SequenceNumber in the JSON,</p>
  
  <pre><code>{
    ALPHG: { Count: 2, Port: "A,B" },
    SFD: { Count: 2, Port: "C,D" },
    ALPHG: { Count: 2, Port: "E,F" },
    BETA: { Count: 1, Port: "G" }
  }
  </code></pre>
  
  <p>How can i put this duplicate name in the Map based on the SequenceNumber from JSON</p>