How to count json data item ionic2 [edit]

My JSON data

"    RESULT":{
                { "@NAME" : "creator", 
                  "@COUNT" : "20",
                      "@KEY":"Book Company1",
                      "@KEY":"Book Company1์",
                { "@NAME" : "lang", 
                  "@COUNT" : "70",
                { "@NAME" : "bnb", 
                  "@COUNT" : "64",


I want to counting the amount that @NAME for setting an array for the FACET and showing the KEY per FACET[] which seems to be the end goal.

Yes, you totally know what I meant. But i want output is every @KEY of that FACET[]

Example :

<ion-select [(ngModel)]="refine" (ionChange)="optionsFn();">
            <ion-option value="..." *ngFor="let item of date">{{item["@NAME"]}},({{item["@COUNT"]}})</ion-option>
          <ion-item *ngFor="let item of foundRepos" (click)="itemClicked($event,item)">
            <h3> {{ item[@KEY"] }}</h3>


optionsFn(): void {
                        .subscribe(data =>{
                       ; //get @NAME
err => console.error(err),
                           () => console.log('getRepos completed')



                        .subscribe(data =>{
                                 this.foundRepos=data.json().RESULT.FACET[0,1,2,3.4......].FACET_VALUES; ///get @KEY
                        } );


from above ion-select is show creator , lang and bnb ,I want to If When I select item ion-option value="..." to keep number of “@NAME

example counting amount of @NAME is 3 and

  • when I select creator is ion-option value="..." << is 0
  • when I select lang is ion-option value="..." << is 1
  • when I select bnb is ion-option value="..." << is 2
  • and If i get value ,I take it to goToapply() for set FACET[]

example I select bnb I get value =2 and console.log(this.refine); is show 2
take it(2) to let p = this.refine , so that p = 2
take p to this.foundRepos=data.json().RESULT.FACET[p].FACET_VALUES; for show @KEY in ion-list
example :When I select lang output on ion-list is


But I don’t know to set option value=“…” to keep number 0,1,2,3 respectively