I'm creating a JSON array with lots of objects, like:
var JSON = [];
var obj1 = {
"familyId": 5,
"implant": [{
"reference": 12345678,
"quantity": 3,
"origin": "ours",
"lot": null
}]
}
var obj2 = {
"familyId": 5,
"implant": [{
"reference": 12345678,
"quantity": 2,
"origin": "theirs",
"lot": null
}]
}
JSON.push(obj1);
JSON.push(obj2);
How can I search this JSON array (using maybe find()
or indexOf()
) to determine the quantity of reference "12345678" with origin "ours"?