I would like to get data from the server using the following method:
searchProducts(): Observable<Product[]> {
return this.http.get<Product[]>('/lerp-product-product');
}
But the data from the server looks like this:
{
"desc": "",
"auth": 0,
"success": 1,
"messages": [],
"obj": null,
"arr": [
{
"product_uuid": "6d80eb05-451e-4309-b0cf-070a14a8e22e",
"product_no": "97508175",
"product_structure": "list",
"product_origin": "intern",
"product_type": "part",
"product_version_extern": "",
"product_revision_extern": "",
}
],
"countProducts": 28
}
The problem is that the data for the observable is in arr. How can you tell Angular.http that the data is in arr and not directly in the root of the JSON response?
.pipe(map(res => res.arr))?