*/ //---- includes ---------------------------------------------------------------- /** * @include JSON */ require_once(dirname(__FILE__).'/../json.php'); //---- class ------------------------------------------------------------------- class MyObj { var $id = ''; var $name = ''; var $attribs = array("first",'4'); function setId($id) { $this->id = $id; } function getId() { return $this->id; } function setName($name) { $this->name = $name; } function getName() { return $this->name; } } //---- variables --------------------------------------------------------------- $JSON = new JSON(); $myObj = new MyObj(); //---- logic ------------------------------------------------------------------- /* initialize object */ $myObj->setId('�l' . chr(18) . "ie\nn"); $myObj->setName('objectName'); array_push($myObj->attribs, '�first'); array_push($myObj->attribs, 'second'); array_push($myObj->attribs, 3); /* create JSON representation */ $jsonStr = $JSON->stringify($myObj); //---- clean-up ---------------------------------------------------------------- //---- content ----------------------------------------------------------------- ?> JSON parser test \n"; ?>