If you don't know what exact properties (company1, company2, ...) your JSON can contain, you need firstly to extract them.
Since objects in javascript can be accessed in similar manners like arrays, you can easy iterate all properties with for (var property in myjson)
and access its values like myjson[property]
Try something like this:
var myjson = {
company1: { status: "success", },
company2: { status: "failure", },
company3: { status: "success", },
};
var count = 0;
for (var property in myjson)
{
if (myjson.hasOwnProperty(property) && myjson[property].status == "success")
{
count++;
}
}
For more information about iterating object of unknown structure, check this post Iterate through object properties