_getJsonServices(); return $jsonServices->encode($value); } /** * Decode a JSON string. * @param $json string The content to decode. * @return mixed */ function decode($json) { // Use the native function if possible if (function_exists('json_decode')) return json_decode($json); // Otherwise fall back on the JSON services library $jsonServices = $this->_getJsonServices(); return $jsonServices->decode($json); } /** * Private function to get the JSON services library */ function _getJsonServices() { require_once('lib/pkp/lib/json/JSON.php'); return new Services_JSON(); } } ?>