I'm going to assume you aren't dealing with JSON at all, but with an object tree parsed from JSON. And I'm going to assume what you've given is the content of an object definition, like this JSON:
{
"PlayerNumbers": {
"PlayerNumber": [
{
"Section": "1",
"Team": "1",
"Direction": "N",
"Number": "00280149",
"Name": " ANSART A",
"Updated": "False",
"TimeLog": "",
"Processed": "False"
},
{
"Section": "1",
"Team": "1",
"Direction": "S",
"Number": "00280131",
"Name": "ANSART Y",
"Updated": "False",
"TimeLog": "",
"Processed": "False"
},
{
"Section": "1",
"Team": "2",
"Direction": "N",
"Number": "01964990",
"Name": " LAHAYE B",
"Updated": "False",
"TimeLog": "",
"Processed": "False"
}
]
}
}
So having parsed the JSON, you'll have an object with a PlayerNumbers property, which refers to an object with a PlayerNumber property, which refers to an array of objects with the information you want.
So you loop through the array until you find the first matching entry (assuming you only want the first one):
var name;
obj.PlayerNumbers.PlayerNumber.some(function(entry) {
if (entry.Section == "1" && Team == "2" && entry.Direction == "N") {
name = entry.Name;
return true;
}
return false;
});
If you want all of the matches:
var names = obj.PlayerNumbers.PlayerNumber.filter(function(entry) {
return (entry.Section == "1" && Team == "2" && entry.Direction == "N");
}).map(function(entry) { return entry.Name; });
Both of the above use ES5 features of Array missing on outdated engines. If you need to support outdated engines, all of the above can be "shimmed" or "polyfilled," a search should turn up the necessary shims/polyfills.
{at the beginning and}at the end (or similar).PlayerNumberarray.json.PlayerNumbers.PlayerNumber.map(function(a){return a.Section==1 && a.Direction=="N" && a.Name;}).filter(Boolean);.filterbefore the.map