This is the JSON I get
entityData = [
{
"is_place":false,
"type":[
"Person"
],
"is_organization":false,
"name":[
"Kevin Presto"
],
"occurrences":38,
"is_person":true,
"jobTitle":[
"Vice President"
],
"label":"Presto"
},
{
"is_place":false,
"label":[
"Paris salon",
"Paris Salonu",
"Salon (mostra)"
],
"occurrences":1,
"is_person":false
},
{
"is_place":false,
"label":"IEP Paris",
"is_organization":true,
"occurrences":1,
"is_person":false
}
]
But it comes as a text format,
if (entityData === Array) {
console.log('entityData is Array!');
} else {
console.log('Not an array');
}
Then I loop through to find if is_place
is true
for (_i = 0, _len = entityData.length; _i < _len; _i++) {
entity = entityData[_i];
console.log('for loop going '+entity)
if (entity.is_place === true) {
console.log('place found found')
}
}
But above code log each and every character of the entityData
Where I'm wrong.
UPDATE: I was following @shreedhar answer and got following error, any idea where I'm doing wrong.
TypeError: entityData.forEach is not a function
entityData.forEach(function(entity,i){