Метод | Описание | |
---|---|---|
__construct ( integer $use ) | constructs a new JSON instance | |
decode ( string $str ) : mixed | decodes a JSON string into appropriate variable | |
decodeStatic ( $var ) | ||
encode ( mixed $var, $options = null ) : mixed | encodes an arbitrary variable into JSON format | |
encodeResponse ( Gpf_Rpc_Serializable $response ) | ||
encodeStatic ( $var, $options = null ) | ||
isError ( $data, $code = null ) | ||
name_value ( string $name, mixed $value, $options = null ) : string | array-walking function for use in generating JSON-formatted name-value pairs | |
reduce_string ( $str ) : string | reduce a string by removing leading and trailing comments and whitespace | |
utf162utf8 ( string $utf16 ) : string | convert a string from one UTF-16 char to one UTF-8 char | |
utf82utf16 ( string $utf8 ) : string | convert a string from one UTF-8 char to one UTF-16 char |
Метод | Описание | |
---|---|---|
isJsonDecodeEnabled ( ) | ||
isJsonEncodeEnabled ( ) |
Метод | Описание | |
---|---|---|
getInstance ( ) |
public __construct ( integer $use ) | ||
$use | integer | 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() |
public decode ( string $str ) : mixed | ||
$str | string | JSON-formatted string |
Результат | 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 encode ( mixed $var, $options = null ) : mixed | ||
$var | mixed | 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! |
Результат | mixed | JSON string representation of input var or an error if a problem occurs |
public encodeResponse ( Gpf_Rpc_Serializable $response ) | ||
$response | Gpf_Rpc_Serializable |
public reduce_string ( $str ) : string | ||
$str | string string value to strip of comments and whitespace | |
Результат | string | string value stripped of comments and whitespace |
public utf162utf8 ( string $utf16 ) : string | ||
$utf16 | string | UTF-16 character |
Результат | string | UTF-8 character |
public utf82utf16 ( string $utf8 ) : string | ||
$utf8 | string | UTF-8 character |
Результат | string | UTF-16 character |