I need to get the values "channelA" and "channelB", which are the object names.
JSON file:
[
    {
        "channelA": {
            "programmes": [
                {
                    "start_utc": 1522208700,
                    "stop_utc": 1522209600,
                },
                {
                    "start_utc": 1522209600,
                    "stop_utc": 1522210800,
                }
            ]    
        }
   },
   {
      "channelB": {
          "programmes": [
               {
                  "start_utc": 1522256700,
                  "stop_utc": 1522260800                     
               },
               {
                  "start_utc": 152229000,
                  "stop_utc": 1522318900,                     
               }
           ]
       }
   }
]    
I am storing the JSON in a value called epg, and iterating through epg with:
for (var k = 0; k < epg.length; k++) {          
    console.log(_epg[k]);   
}
I need to compare the name of the object with another variable (channelId):
for (var k = 0; k < _epg.length; k++) {
    if (channelId == epg[k]) {
       console.log(_epg[k]);
    }
}

 
     
     
     
     
     
    