var arr = ['h', 'e', 'l', 'l', 'o']; var obj = {}; obj[arr[0]] = {}; obj[arr[0]][arr[1]] = arr.slice(2).join(''); alert(JSON.stringify(obj,'',2));