Craig D'Avignon Craig D'Avignon - 1 year ago 90
jQuery Question

Trying to loop through Json Object that has more objects inside with arrays of objects

I've been beating my head against the wall trying to loop through this json file.

when I console log this it says that the Response is an Object, data is an object, saleItemCategories is an array, which has four objects the first being vehicles which is an array of item objects.

Basically I am trying to get the various values from these item objects. At this point I'm just looking for help drilling down to this level.







I have tried looping through each Response as object, then for each data as object, then I tried looping through the saleItemCategories array, but this is usually where it breaks

Answer Source
var json = "your data";

var itemCategories =;

for (int i = 0; i < itemCategories.length; i++) {
  var categoryItems = itemCategories[i].saleItems;

  for (int j = 0; j < categoryItems.length; j++) {
    var categoryItem = categoryItems[j];
    var categoryItemStats = categoryItem.stats;


    for (var k = 0; k < categoryItemStats; k++) {
      var categoryItemStat = categoryItemStats[k];

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download