I have the following JSON data:
{ "damages": { "regions": [{
"name": "External Damages",
"totalEstimatedCost": "$ 0.00",
"damageDetails": [{
"areaDes": "FRONT Hood",
"type": "Prev Repair",
"desc": "Acceptable",
"estimate": "$ 0.00",
"isClickable": true,
"regularUrl": "https://adesa.test2.kar-media.com/display.php?img=283509519_d_ee9339f0-d9d9-48cb-ab15-66831f95dcd7-Original.jpg",
"midSizedPath": "https://adesa.test2.kar-media.com/display.php?img=283509519_d_ee9339f0-d9d9-48cb-ab15-66831f95dcd7-Original_lb.jpg",
"thumbNailPath": "https://adesa.test2.kar-media.com/display.php?img=283509519_d_ee9339f0-d9d9-48cb-ab15-66831f95dcd7-Original_th.jpg"
}] }, {
"name": "Other Damages",
"totalEstimatedCost": "$ 0.00",
"damageDetails": [{
"areaDes": "FRONT Front Bumper Cover",
"type": "Prev Repair",
"desc": "Acceptable",
"estimate": "$ 0.00",
"isClickable": true,
"regularUrl": "https://adesa.test2.kar-media.com/display.php?img=283509519_d_ee9339f0-d9d9-48cb-ab15-66831f95dcd7-Original.jpg",
"midSizedPath": "https://adesa.test2.kar-media.com/display.php?img=283509519_d_ee9339f0-d9d9-48cb-ab15-66831f95dcd7-Original_lb.jpg",
"thumbNailPath": "https://adesa.test2.kar-media.com/display.php?img=283509519_d_ee9339f0-d9d9-48cb-ab15-66831f95dcd7-Original_th.jpg"
... (content shortened for brevity) ...
}
] } ], "totalDamages": 10, "totalCost": "$ 0.00" } }
In the above JSON data, I am looking to extract all regularUrl
s into a single array. How can this be achieved using mapping in Angular 2/TypeScript/RxJS?
Currently, I am using two for loops or three .maps functions to compile the regularUrls into one array.
Is there a way to solve this using RxJS or TypeScript in Angular 2?
Any guidance on potential solutions would be greatly appreciated. Thank you.