$VAR1 = { '6' => { 'parent' => '0', 'title' => 'War3', 'id' => '6', 'descr' => 'I have no subcategories' }, '1' => { 'parent' => '0', 'children' => [ { 'parent' => '1', 'children' => [ { 'parent' => 3, 'children' => [ { 'parent' => 7, 'title' => 'main sub cat1 sub cat1 sub cat1', 'id' => '9', 'descr' => 'Wewt, more recursion of doom!' } ], 'title' => 'main sub cat1 sub cat1', 'id' => 7, 'descr' => 'Sub category for a sub category! wewt.' } ], 'title' => 'main sub cat1', 'id' => 3, 'descr' => 'This is a subcategory for the main column' }, { 'parent' => '1', 'title' => 'main sub cat2', 'id' => 4, 'descr' => 'This is the second subcategory for the main column' } ], 'title' => 'Main', 'id' => '1', 'descr' => 'This is the main category, used for all stuff that doesn\'t fit else where.' }, '2' => { 'parent' => '0', 'children' => [ { 'parent' => '2', 'children' => [ { 'parent' => 5, 'title' => 'd2 sub cat sub cat', 'id' => 8, 'descr' => 'Yet another sub sub category' } ], 'title' => 'Diablo subcategory', 'id' => 5, 'descr' => 'A subcategory for the diablo 2 section.' } ], 'title' => 'Diablo', 'id' => '2', 'descr' => 'This is the main diablo category' } };