I receive a valid json object for error messages from the server. I would like to loop through each error and nicely display the error in the web page. Here is example of the json from the server
{
"contract.cashPrice":[
"Cash price is required"
],
"contract.cashDownPayment":[
"Cash down payment is required"
],
"contract.effectiveDate":[
"Effective date is required"
],
"contract.firstPaymentDate":[
"First payment date is required"
],
"contract.mode":[
"Mode is required"
],
"contract.numberOfPayments":[
"Number of payments is required"
],
"contract.financeChargePercent":[
"Finance charge percent is required"
]
}
when i loop through this error object, i am only able to receive the object property, but not the values. below is the stub code i have written so far. any help is greatly appreciated.
for(var error in errors){
error.forEach(function(message){
console.log(message);
});
}