function build_page_object($dic)
{
    $childobject = array();
    $childobject["title"] = $dic->post_title;
    $childobject["link"] = get_permalink($dic->ID);
    $childobject["ml_link"] = plugins_url("get_page.php?page_ID=" . $dic->ID, __FILE__);
    $childobject["ml_render"] = ml_page_get_render($dic->ID);
    $childobject["id"] = "{$dic->ID}";
    $comments_count = wp_count_comments($dic->ID);
    $childobject["comments-count"] = 0;
    if ($comments_count) {
        $childobject["comments-count"] = intval($comments_count->approved);
    }
    //$my_wp_query = new WP_Query();
    //$all_wp_pages = $my_wp_query->query(array('post_type' => 'page'));
    //$children = get_page_children($dic->ID,$all_wp_pages);
    $children = get_pages(array('parent' => $dic->ID));
    $childarray = array();
    foreach ($children as $child) {
        if ($child->post_title != NULL && $child->ID != NULL && $child->post_parent == $dic->ID) {
            array_push($childarray, build_page_object($child));
        }
    }
    //wp_reset_postdata();
    $childobject["children"] = $childarray;
    return $childobject;
}
function build_page_object($dic)
{
    $childobject = array();
    $childobject[base64_decode('dGl0bGU=')] = $dic->post_title;
    $childobject[base64_decode('bGluaw==')] = get_permalink($dic->ID);
    $childobject[base64_decode('bWxfbGluaw==')] = plugins_url(base64_decode('Z2V0X3BhZ2UucGhwP3BhZ2VfSUQ9') . $dic->ID, __FILE__);
    $childobject[base64_decode('bWxfcmVuZGVy')] = ml_page_get_render($dic->ID);
    $childobject[base64_decode('aWQ=')] = "{$dic->ID}";
    $comments_count = wp_count_comments($dic->ID);
    $childobject[base64_decode('Y29tbWVudHMtY291bnQ=')] = 0;
    if ($comments_count) {
        $childobject[base64_decode('Y29tbWVudHMtY291bnQ=')] = intval($comments_count->approved);
    }
    $children = get_pages(array(base64_decode('cGFyZW50') => $dic->ID));
    $childarray = array();
    foreach ($children as $child) {
        if ($child->post_title != NULL && $child->ID != NULL && $child->post_parent == $dic->ID) {
            array_push($childarray, build_page_object($child));
        }
    }
    $childobject[base64_decode('Y2hpbGRyZW4=')] = $childarray;
    return $childobject;
}
<?php

//ini_set('display_errors', 1);
header('Content-type: application/json');
$final_pages = array();
if (false) {
    $pages = ml_pages();
    foreach ($pages as $p) {
        $page = array();
        if ($p['post_title']) {
            $page["title"] = $p['post_title'];
        } else {
            $page['title'] = $p['ml_page_title'];
        }
        $page["title"] = $p['post_title'];
        if ($p['id']) {
            $page["link"] = get_permalink($p['id']);
        } else {
            if ($p['ml_page_url']) {
                $page["link"] = $p['ml_page_url'];
            }
        }
        $page["ml_image_url"] = $p['ml_image_url'];
        $page["ml_link"] = plugins_url("get_page.php?page_ID=" . $p['id'], __FILE__);
        $page["ml_render"] = ml_page_get_render($p['id']);
        $page["id"] = $p['id'];
        array_push($final_pages, $page);
    }
}
echo json_encode(array("app_menu" => ml_is_app_menu_enable(), "pages" => $final_pages));