I read here some topics how to get properties values from an object.
In my case, I have something in Controller:
[HttpPost]
public ActionResult GetSomething() {
return Json( new {
data = AModel.Get()
}, JsonRequestBehavior.AllowGet );
}
In model:
public static List<Hashtable> Get() {
List<Hashtable> list = new List<Hashtable>( 0 );
Hashtable table = new Hashtable();
table.Add( "ITEM_1", "Value1" );
table.Add( "ITEM_2", "Value 32" );
list.Add( table );
table = new Hashtable();
table.Add( "ITEM_1", "Value22" );
table.Add( "ITEM_2", "Other" );
list.Add( table );
return list;
}
And in Javascript:
var test;
$.ajax({
type: "post",
url: "Action/Controller",
data: {},
dataType: "json",
async: false,
success: function (data) {
test = data.data;
},
complete: function () {
console.log(test);
});
I got in console like in the following image:

I want to get the value of property ITEM_1 and results to me : Value1, Value22.
I tried with
for(var key in test) {
console.log(test[key].ITEM_1);
//console.log(test[key].ITEM1);
}
but it not works.
Of course, I renamed ITEM_1 key into ITEM1 (in model) but same result : undefined but in console I see the values for all object.

Help me please.
testis an array and not an object. loop through the array like: