{ Name: 'Badli (North West Delhi)' , Description: null , BranchType: 'Sub Post Office' , DeliveryStatus: 'Non-Delivery' , Circle: 'Delhi' , District: 'North West Delhi' , Division: 'Delhi North' , Region: 'Delhi' , Block: 'Delhi' , State: 'Delhi' , Country: 'India' , Pincode: '110042' } 1 : { Name: 'Delhi Engg. College' , Description: null , BranchType: 'Sub Post Office' , DeliveryStatus: 'Non-Delivery' , Circle: 'Delhi' , District: 'North West Delhi' , Division: 'Delhi North' , Region: 'Delhi' , Block: 'Delhi' , State: 'Delhi' , Country: 'India' , Pincode: '110042' } { Name: 'Pehlad Pur' , Description: null , BranchType: 'Branch Post Office' , DeliveryStatus: 'Delivery' , Circle: 'Delhi' , District: 'North West Delhi' , Division: 'Delhi North' , Region: 'Delhi' , Block: 'Delhi' , State: 'Delhi' , Country: 'India' , Pincode: '110042' } 3 : { Name: 'Samai Pur' , Description: null , BranchType: 'Sub Post Office' , DeliveryStatus: 'Delivery' , Circle: 'Delhi' , District: 'North West Delhi' , Division: 'Delhi North' , Region: 'Delhi' , Block: 'Delhi' , State: 'Delhi' , Country: 'India' , Pincode: '110042' } 4 : { Name: 'Shahbad Daulatpur' , Description: null , BranchType: 'Branch Post Office' , DeliveryStatus: 'Delivery' , Circle: 'Delhi' , District: 'North West Delhi' , Division: 'Delhi North' , Region: 'Delhi' , Block: 'Delhi' , State: 'Delhi' , Country: 'India' , Pincode: '110042' } 5 : { Name: 'Siraspur' , Description: null , BranchType: 'Branch Post Office' , DeliveryStatus: 'Delivery' , Circle: 'Delhi' , District: 'North West Delhi' , Division: 'Delhi North' , Region: 'Delhi' , Block: 'Delhi' , State: 'Delhi' , Country: 'India' , Pincode: '110042' } |
const postOffices = result[0]?.PostOffice; // Ensure `postOffices` is iterable const postOfficesArray = Array.isArray(postOffices) ? postOffices : (postOffices ? Object.values(postOffices) : []); const filteredResults = []; // Filter and manually extract `Name` and `DeliveryStatus` for (const office of postOfficesArray) { if (office.DeliveryStatus === "Delivery") { filteredResults.push({ Name: office.Name, DeliveryStatus: office.DeliveryStatus }); } } return filteredResults; |