I see there is a problem to get a String name from JSON object's name. I need to parse this kind on JSON response from server.
var response = {
  hopaopGmailsjIpW: {
    GmailsjIpW_totalEmails_count: 133,
    GmailsjIpW_state: 1
  },
  hopaopGmail4y4yu: {
    Gmail4y4yu_totalEmails_count: 156,
    Gmail4y4yu_state: 1
  }
}
It is not an Array, but the object with inner objects.
i need to parse an inner ojects name and add additional values to each object.
i want be able to do something like this:
for(var i =0; i < response.length; i++){
  response[i].username = parseUsernameFromString(response[i]);
  response[i].service = parseServiceFromString(response[i]);
  response[i].id = parseIdString(response[i]);
}
(and also state for each task)
So the question is: What is the best way to make it?
UPDATE this is exactly what i have for now:
for(var key in response){
    if(stringContains(response[key], "Gmail")) { response[key].service = "Gmail";}
        console.log("task name: "+ response[key].service);
}
function stringContains(originalString, searchString){
        if(originalString.indexOf(searchString) > -1){
            return true
        }
            else return false;
}
 
     
    