Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

Services_JSON Class Reference

List of all members.

Public Member Functions

 Services_JSON ($use=0)
 constructs a new JSON instance
 utf162utf8 ($utf16)
 convert a string from one UTF-16 char to one UTF-8 char
 utf82utf16 ($utf8)
 convert a string from one UTF-8 char to one UTF-16 char
 encode ($var)
 encodes an arbitrary variable into JSON format
 name_value ($name, $value)
 array-walking function for use in generating JSON-formatted name-value pairs
 reduce_string ($str)
 reduce a string by removing leading and trailing comments and whitespace
 decode ($str)
 decodes a JSON string into appropriate variable

Public Attributes

return $utf8
 $arr = array()
 $chrs = substr($str, 1, -1)
 $substr_chrs_c_2 = substr($chrs, $c, 2)
 $val = $this->decode($parts[2])
 $c

Constructor & Destructor Documentation

Services_JSON::Services_JSON use = 0  ) 
 

constructs a new JSON instance

Parameters:
int $use object behavior flags; combine with boolean-OR
possible values:
  • SERVICES_JSON_LOOSE_TYPE: loose typing. "{...}" syntax creates associative arrays instead of objects in decode().
  • SERVICES_JSON_SUPPRESS_ERRORS: error suppression. Values which can't be encoded (e.g. resources) appear as NULL instead of throwing errors. By default, a deeply-nested resource will bubble up with an error, so all return values from encode() should be checked with isError()

Definition at line 128 of file json-lib.inc.php.


Member Function Documentation

Services_JSON::decode str  ) 
 

decodes a JSON string into appropriate variable

Parameters:
string $str JSON-formatted string
Returns:
mixed number, boolean, string, array, or object corresponding to given JSON input string. See argument 1 to Services_JSON() above for object-output behavior. Note that decode() always returns strings in ASCII or UTF-8 format! public

Definition at line 475 of file json-lib.inc.php.

Services_JSON::encode var  ) 
 

encodes an arbitrary variable into JSON format

Parameters:
mixed $var any number, boolean, string, array, or object to be encoded. see argument 1 to Services_JSON() above for array-parsing behavior. if var is a strng, note that encode() always expects it to be in ASCII or UTF-8 format!
Returns:
mixed JSON string representation of input var or an error if a problem occurs public

Definition at line 232 of file json-lib.inc.php.

Services_JSON::name_value name,
value
 

array-walking function for use in generating JSON-formatted name-value pairs

Parameters:
string $name name of key to use
mixed $value reference to an array element to be encoded
Returns:
string JSON-formatted name-value pair, like '"name":value' private

Definition at line 426 of file json-lib.inc.php.

Services_JSON::reduce_string str  ) 
 

reduce a string by removing leading and trailing comments and whitespace

Parameters:
$str string string value to strip of comments and whitespace
Returns:
string string value stripped of comments and whitespace private

Definition at line 444 of file json-lib.inc.php.

Services_JSON::utf162utf8 utf16  ) 
 

convert a string from one UTF-16 char to one UTF-8 char

Normally should be handled by mb_convert_encoding, but provides a slower PHP-only method for installations that lack the multibye string extension.

Parameters:
string $utf16 UTF-16 character
Returns:
string UTF-8 character private

Definition at line 144 of file json-lib.inc.php.

Services_JSON::utf82utf16 utf8  ) 
 

convert a string from one UTF-8 char to one UTF-16 char

Normally should be handled by mb_convert_encoding, but provides a slower PHP-only method for installations that lack the multibye string extension.

Parameters:
string $utf8 UTF-8 character
Returns:
string UTF-16 character private

Definition at line 188 of file json-lib.inc.php.


Member Data Documentation

Services_JSON::$arr = array()
 

Definition at line 614 of file json-lib.inc.php.

Services_JSON::$c
 

Definition at line 760 of file json-lib.inc.php.

Services_JSON::$chrs = substr($str, 1, -1)
 

Definition at line 635 of file json-lib.inc.php.

Services_JSON::$substr_chrs_c_2 = substr($chrs, $c, 2)
 

Definition at line 657 of file json-lib.inc.php.

return Services_JSON::$utf8
 

Definition at line 605 of file json-lib.inc.php.

Services_JSON::$val = $this->decode($parts[2])
 

Definition at line 683 of file json-lib.inc.php.


The documentation for this class was generated from the following file:
Generated on Fri Oct 27 12:26:42 2006 for BaseJumper by doxygen 1.3.9.1