score:2

Accepted answer
const src = {"physicals":{"followups":{"type":[{"facility":{"desc":"Open daily","code":"MA"},"exercise":[{"gym":"Shrewsburry","id":"1234"},{"gym":"greensville","id":"4321"}],"regular":"N","yoga":"true"}]}}},

      result = src.physicals.followups.type
        .find(({facility:{code}}) => code == 'MA')
        ?.exercise
        .find(({gym}) => gym == 'greensville')
        ?.id
        
console.log(result)

score:1

if (id == "No Data") {
    var facilityArray = value.exercise;
    var greenvilleId = facilityArray
        .filter((facility) => facility.gym === "Greenville").id
}

Related Query

More Query from same tag