 <pre><code>var level=0; var levelarray=[]; function looptrough(obj){ for(key in obj){ if(typeof obj[key]=="object"){ level++; looptrough(obj[key]); level--; } levelarray[level]=levelarray[level] || {}; levelarray[level][key]=obj[key]; } } looptrough({a:true;b:{c:true}}); </code></pre> <p>Levelarray should now contain:</p> <pre><code>0:{a:true;b:{c:true}} 1:{c:true} </code></pre> <p>I thought using jquery is quite unecessary in that case, thats why i used for in...</p>