for (var key in validation_messages) {// skip loop if the property is from prototypeif (!validation_messages.hasOwnProperty(key)) continue;
var obj = validation_messages[key];for (var prop in obj) {// skip loop if the property is from prototypeif (!obj.hasOwnProperty(prop)) continue;
// your codealert(prop + " = " + obj[prop]);}}
var key, obj, prop, owns = Object.prototype.hasOwnProperty;
for (key in validation_messages ) {
if (owns.call(validation_messages, key)) {
obj = validation_messages[key];
for (prop in obj ) {
// Using obj.hasOwnProperty might cause you headache if there is// obj.hasOwnProperty = function(){return false;}// but 'owns' will always workif (owns.call(obj, prop)) {console.log(prop, "=", obj[prop]);}}}}
// Get every value in the object into a separate array item ...function buildArray(p_MainObj, p_Name) {var variableList = [];var thisVar = "";var thisYes = false;for (var key in p_MainObj) {thisVar = p_Name + "." + key;thisYes = false;if (p_MainObj.hasOwnProperty(key)) {var obj = p_MainObj[key];for (var prop in obj) {var myregex = /^[0-9]*$/;if (myregex.exec(prop) != prop) {thisYes = true;variableList.push({item:thisVar + "." + prop,value:obj[prop]});}}if ( ! thisYes )variableList.push({item:thisVar,value:obj});}}return variableList;}
// Get the object items into a simple array ...var objectItems = buildArray(myObj, "myObj");
// Now use them / test them etc... as you need to!for (var x=0; x < objectItems.length; ++x) {console.log(objectItems[x].item + " = " + objectItems[x].value);}
function loopThrough(obj){for(var key in obj){// skip loop if the property is from prototypeif(!obj.hasOwnProperty(key)) continue;
if(typeof obj[key] !== 'object'){//your codeconsole.log(key+" = "+obj[key]);} else {loopThrough(obj[key]);}}}loopThrough(validation_messages);