function gs_json_encode($content) { if (!extension_loaded('json')) { if (!class_exists('GS_Services_JSON')) { require_once 'GSJSON.php'; } $json = new GS_Services_JSON(); return $json->encode($content); } else { return json_encode($content); } }
function gs_json_decode($content, $arg) { if (!extension_loaded('json')) { if (!class_exists('GS_Services_JSON')) { require_once 'GSJSON.php'; } $json = new GS_Services_JSON(SERVICES_JSON_LOOSE_TYPE); return $json->decode($content); } else { // just use php's json if it is available return json_decode($content, $arg); } }