how do i map a json object with multiple properties?

if the structure of your data returned has changed, you need to update your map in the service.

 return this.httpClient.get(url).pipe(
    map( (data: any) => => this.adapter.convert(item)) )

you should probably changed the property name you pass into your map to avoid confusion. i.e.

(resp: any) => => this.adapter.convert(item))

The structure of the data returned from the service has changed from and Array to an Object. therefore, you must change your mapping process

this updated code will only return the Data array from your response.

if you need to also return the count, then you will need to update your service method getProductsByCategory to return an object that includes the count as well as the data.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top