function isObjectEmpty(object)
{
var isEmpty = true;
for(keys in object)
{
isEmpty = false;
break; // exiting since we found that the object is not empty
}
return isEmpty;
}
Example:
var myObject = {}; // Object is empty
var isEmpty = isObjectEmpty(myObject); // will return true;
// populating the object
myObject = {"name":"John Smith","Address":"Kochi, Kerala"};
// check if the object is empty
isEmpty = isObjectEmpty(myObject); // will return false;