Need to Iterate JSON object
I have a JSON object:
users:[
user{
{
emailAddress
:
"none"
- firstName: "na"
- globalId: "testus1"
- lastName: "TestUS1"
- selectedDuties: "User" },
- {
- emailAddress: "none"
- firstName: "na"
- globalId: "testus2"
- lastName: "TestUS2"
- selectedDuties: "User"
}
- }
- ]
Im trying to do a check based on my global id. But im not able to...
$.each(data.user,function(index,val){
for (var x=0; x < data.user.length;x++){
if ( data.user[x] == "globalId") {
var actualData ={};
actualData.data=val;
jsObject.json_data.data.push(actualData);
}
}
}
Here data.user.length gives the value, where as if i check data.user[x] it gives undefined.
Can any one please help me out to solve this...
Thanks in advance...