I currently have the following code which produces an error with the keys variable retrieving the json value.
var data;
var store;
for (var a in keys){
for(var b in person){
data = person[b].keys[a];
if (data=="1"){
store += "hit ";
}
}
}
The json object im testing with looks like:
var person = [
{
"Permissions": "Admin",
"Scope": "Super powers",
"ReadOnly User": "stuff",
"Admin User":"1"
},
{
"Permissions": "Read-Only",
"Scope": "Reading",
"ReadOnly User": "some stuff",
"Admin User":"0"
},
{
"Permissions": "Do Guy",
"Scope": "Labour",
"ReadOnly User": "many things",
"Admin User":"1"
}
];
and keys are retrieved with the following:
var keys =[];
if(person.hasOwnProperty(0)){
for(var prop in person[0]){
if(person[0].hasOwnProperty(prop)){
if(prop !== 'Permissions' && prop !== 'Scope'){
keys.push(prop);
}
}
}
}
The end result of this should have two hits in store for each Admin User key with a 1