Not able to get values in multidimensional array

Viewed 22

I'm new to angular, and I'm trying to access the elements in a multidimensional array. The array has this structure:

 [ 
   [ 
     { 
        "id": 983784, 
        "firstname": "Test", 
        "lastname": "Test", 
        "uid": "test@test.com"
     }
  ]
]

but whenever I try to print its [0] element, I see on the console that the value is undefined. Shouldn't it be another array? How can I create another array with only the various fields that are in the inner part? Thanks!

EDIT:

these are the methods that I'm calling in order to get this response.

filterAndUpdate<T>(url: string, entity: string) { 
    this.filter<T>(encodeURI(url)) 
        .pipe( 
            map((res) => (res['_object'] ? res['_object'][entity] : [])), 
            tap((bps) => { 
              this.response.push(bps); 
            }) 
        ) 
        .subscribe(); 
    return this.response 
}
filter<T>(url: string): Observable<T> { 
    this.loadingService.loadingOn(); 
    return this.envConfigurationService.load().pipe( 
        concatMap(c => this.http.get<T>( url.indexOf( 
            c.apiUrl + '/' + conf.apiPrefix + '/') === -1 ? c.apiUrl + '/' + conf.apiPrefix + '/' + url : url)), 
        finalize(() => this.loadingService.loadingOff()), 
        catchError((err) => { 
          this.manageError(err); 
          return throwError(err); 
        }) 
    ) 
}
0 Answers
Related