I have a json data like below
var data = [
{
"type": "Feature",
"id": 1,
"properties":
{
"name": "William",
"categorie": 107,
"laporan":"Fire",
"time":1,
"type": "Firefighter",
"phone_number": "0111111"
}, "geometry":
{
"type": "Point",
"coordinates": [ 106.814893, -6.219156]
}
}
,
{
"type": "Feature",
"id": 7,
"properties":
{
"name": "John",
"categorie": 103,
"laporan":"Thief",
"time":3,
"type": "Police",
"phone_number": "0987654321"
}, "geometry":
{
"type": "Point",
"coordinates": [ 106.794107, -6.286935 ]
}
}
]
I want to filter the json data above to get properties and coordinates based on time, I have tried using code below, but it's not showing the data I want
var data_filter=data.filter(function(item){
return item.properties.time==1;
});
console.log(data_filter)
Do you know how I'm filtering the json data to get properties and coordinate data ?
Thank you
dataalready an object?