library = JSON_NATIVE; } } /** * Encodes an object to JSON */ public function encode($anObject) { if ($this->library == JSON_PEAR) { $pear = new Services_JSON(); $e = new mb_notice("using PEAR JSON"); return $pear->encode($anObject); } $e = new mb_notice("using native JSON"); return json_encode($anObject); } /** * Decodes a JSON string */ public function decode($aString) { if ($this->library == JSON_PEAR) { $pear = new Services_JSON(); $e = new mb_notice("using PEAR JSON"); return $pear->decode($aString); } $e = new mb_notice("using native JSON"); return json_decode($aString); } } ?>