I'm looking to get count of active products according to this JSON data.
$(document).ready (function () {
var JSONdata = {
"products":[
{
"id_product":"261",
"status":"Active",
"price":"50.00"
},
{
"id_product":"267",
"status":"Active",
"price":"100.00"
},
{
"id_product":"280",
"status":"Inactive",
"price":"600.00"
}
]
};
alert("Active products : " + JSON.stringify(JSONdata.length));
//Excepted result
//Active products : 2
});
I made a JSfiddle, I couldn't figure it out how to get count of active products.
http://jsfiddle.net/ot6emj0n/2/
This JSON data contains 3 products, 2 actives and 1 inactive.
Excepted result what Im looking is "Active products: 2"