Class Services_JSON

Description

Located in /JSON.php (line 114)


	
			
Method Summary
Services_JSON Services_JSON ([int $use = 0])
mixed decode (string $str)
mixed encode (mixed $var)
void isError ( $data, [ $code = null])
string name_value (string $name, mixed $value)
string reduce_string ($str $str)
string utf82utf16 (string $utf8)
string utf162utf8 (string $utf16)
Methods
Constructor Services_JSON (line 132)
Services_JSON Services_JSON ([int $use = 0])
  • 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()
decode (line 483)
  • return: 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!
  • access: public
mixed decode (string $str)
  • string $str: JSON-formatted string
encode (line 236)
  • return: JSON string representation of input var or an error if a problem occurs
  • access: public
mixed encode (mixed $var)
  • 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!
isError (line 764)
  • todo: Ultimately, this should just call PEAR::isError()
void isError ( $data, [ $code = null])
  • $data
  • $code
name_value (line 433)
  • return: JSON-formatted name-value pair, like '"name":value'
  • access: private
string name_value (string $name, mixed $value)
  • string $name: name of key to use
  • mixed $value: reference to an array element to be encoded
reduce_string (line 452)
  • return: string value stripped of comments and whitespace
  • access: private
string reduce_string ($str $str)
  • $str $str: string string value to strip of comments and whitespace
utf82utf16 (line 192)
  • return: UTF-16 character
  • access: private
string utf82utf16 (string $utf8)
  • string $utf8: UTF-8 character
utf162utf8 (line 148)
  • return: UTF-8 character
  • access: private
string utf162utf8 (string $utf16)
  • string $utf16: UTF-16 character

Documentation generated on Thu, 18 Oct 2007 13:50:11 -0300 by phpDocumentor 1.3.2