I have the following JSON. I have a parameter to give and I need to return all the number.
If I give "BUS", I need to return1,38,44,58
Example of JSON:
{
_id:"23456789",
result:[
[
"Car",
[
[
2,
3,
4,
6
],
[
3,
4,
444,
123
],
[
43,
34,
91446,
344473
]
]
],
[
"Bus",
[
[
1,
38,
4458,
0981
]
]
],
[
"Moto",
[
[
5,
43,
41440,
804444
]
]
]
]
}
This is my code:
var coordinates = [];
console.log("tag :"+tag); // tag is the parameter "Bus", "Car" or "Moto"
$http.get('http://myserver:1234/bbox/'+id)
.success(function (response) {
var point = {};
// Don't know how to catch a specific word (i.e Car or BUS or Moto)
for (var i in response){
var pointName = response.result[i][0];
coordinates.push(response.result[i][1]);
points[pointName] = coordinates;
}
})
.error(function (response) {
console.log(response);
});
tag is already set with only one parameter.
Just need to return the coordinate for one given.
Thanks for your help!