Public Member Functions | |
decode ($json, $assoc=false, $depth=512) | |
encode ($value, $options=0) | |
The JSONCodec class simplify JSON encoding/decoding errors handling by throwing Dcp, with corresponding JSON error constant, instead of returning null on errors (which could be mistaken with valid JSON null values for example).
Definition at line 12 of file Class.JSONCodec.php.
decode | ( | $json, | |
$assoc = false , |
|||
$depth = 512 |
|||
) |
Decode JSON string
string | $json | see $json from PHP's json_decode() |
bool | $assoc | see $assoc from PHP's json_decode() |
int | $depth | see $depth from PHP's json_decode() |
Dcp\Exception | Exception is throwned on error |
Definition at line 24 of file Class.JSONCodec.php.
encode | ( | $value, | |
$options = 0 |
|||
) |
Encode value into JSON string
mixed | $value | see $value from PHP's json_encode() |
int | $options | see $options from PHP's json_encode() |
Dcp\Exception | Exception is throwned on error |
Definition at line 48 of file Class.JSONCodec.php.