[{ "guide": null, "residence": [{ "name_r": "jack" }, { "name_r": "jim" }, { "name_r": "sara" }], "residence_u": [{ "units": ["hello", "how", "what"], "extra": ["11", "22", "33"], "price": ["1,111,111", "2,222,222", "3,333,333"] }, { "units": ["fine"], "extra": ["44"], "price": ["4,444,444"] }, { "units": ["thanks", "good"], "extra": ["55", "66"], "price": ["5,555,555", "6,666,666"] }] }] success: function (data) { $.each(data[0].residence, function (index, value) { $('ol#residence_name').append('
  • ' + value.name_r + '
  • '); var info = data[0].residence_u[index]; $.each(info.units, function (index, value) { $('ol#residence_name li .tooltip').append(value + ' & ' + info.extra[index] + ' & ' + info.price[index] + '
    '); }) }); var $li = $('
  • ' + value.name_r + '
  • '); var $tooltip = $('
    ').appendTo($li); var info = data[0].residence_u[index]; $.each(info.units, function (index, value) { $tooltip.append(value + ' & ' + info.extra[index] + ' & ' + info.price[index] + '
    '); }); $li.appendTo('#residence_name'); // Declare the variables we're going to use var i, j; // Iterating variables var name, unitsArray, extraArray, priceArray; // Outer loop var unit, extra, price; // Inner loop // Loop through the people for( i in data[0].residence ) { // Assign the outer-loop variables name = data[0].residence[i].name_r; unitsArray = data[0].residence_u[i].units; extraArray = data[0].residence_u[i].extra; priceArray = data[0].residence_u[i].price; // Do something here with the name // For each person, loop through the things they said for( j in unitsArray ) { // Assign the inner-loop variables unit = unitsArray[j]; extra = extraArray[j]; price = priceArray[j]; // Do something here with the 3 inner-loop variables } }