Вот рабочий пример того что нужно было ))) Наконец-то домучал.
// читаем файл с закладками в формате JSON
$str = file_get_contents('Bookmarks');
$ar = json_decode($str);
$root = $ar->roots;
$marks = array();
function normalizeChromiumTime($time) {
return date("H:i:s d-m-Y", ($time - 11644473600000000) / 1000000);
}
function recursiveJSON2ARRAY($obj, $parent = null){
global $marks;
foreach($obj as $v){
if(isset($v->children) && is_array($v->children) && count($v->children) > 0){
$parentname = $v->name;
foreach($v->children as $child){
if(isset($child->url)){
$date_added = normalizeChromiumTime($child->date_added);
$marks[$child->date_added] = array('parentname'=>$parent." -> ".$parentname, 'date'=>$date_added, 'name'=>$child->name, 'url'=>$child->url);
}
else{
recursiveJSON2ARRAY($v->children, $parent." -> ".$parentname);
}
}
}
else{
if(isset($v->url)){
$date_added = normalizeChromiumTime($v->date_added);
$marks[$v->date_added] = array('parentname'=>$parent, 'date'=>$date_added, 'name'=>$v->name, 'url'=>$v->url);
}
}
}
}
foreach($root as $childrenElement){
if(isset($childrenElement->children) && is_array($childrenElement->children)){
recursiveJSON2ARRAY($childrenElement->children, $childrenElement->name);
}
}
//krsort($marks); // Reverse sort the bookmarks by date added
$table = '<table cellspacing="2" cellpadding="2" border="1" width="600"><tr><td><b>Дата создания</b></td><td><b>Категория</b></td><td><b>Имя</b></td><td><b>URL</b></td></tr>';
foreach($marks as $date=>$mark){
$table .= '<tr><td>'.$mark['date'].'</td><td>'.$mark['parentname'].'</td><td>'.$mark['name'].'</td><td><a href="'.$mark['url'].'" target="_blank">'.$mark['url'].'</a></td></tr>';
}
$table .= '</table>';
echo $table;