Example #1
0
function loadJson($path)
{
    if (!is_readable($path)) {
        throw new Exception("File {$path} cannot be read", 1);
    }
    $str = file_get_contents($path);
    try {
        $obj = decodeJson($str);
    } catch (Exception $e) {
        $msg = jsonErrorMessage($e->getCode());
        throw new Exception("JSON error in {$path}: {$msg}", 2, $e);
    }
    return $obj;
}
Example #2
0
 protected function _DECODE_JSON($elem)
 {
     return self::import(decodeJson($elem[SIGN_CDATA]));
 }