<?php
$a = array(
'Alpha' => array('Red' => 'one', 'Blue' => 'two'),
'Bravo' => array('Blue' => 'three'));
function convert_array($from){
if(!is_array($from)){
return false;
}
$to = array();
foreach($from as $k=>$v){
$to[] = array(
'title' => $k,
'children' => convert_array($v)
);
}
return $to;
}
print_r(convert_array($a));