Class yii\helpers\Json
Inheritance | yii\helpers\Json » yii\helpers\BaseJson |
---|---|
Available since version | 2.0 |
Source Code | https://github.com/yiisoft/yii2/blob/master/framework/helpers/Json.php |
Json is a helper class providing JSON data encoding and decoding.
It enhances the PHP built-in functions json_encode()
and json_decode()
by supporting encoding JavaScript expressions and throwing exceptions when decoding fails.
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
$jsonErrorMessages | array | yii\helpers\BaseJson |
Public Methods
Method | Description | Defined By |
---|---|---|
decode() | Decodes the given JSON string into a PHP data structure. | yii\helpers\BaseJson |
encode() | Encodes the given value into a JSON string. | yii\helpers\BaseJson |
errorSummary() | Generates a summary of the validation errors. | yii\helpers\BaseJson |
htmlEncode() | Encodes the given value into a JSON string HTML-escaping entities so it is safe to be embedded in HTML code. | yii\helpers\BaseJson |
Protected Methods
Method | Description | Defined By |
---|---|---|
handleJsonError() | Handles encode() and decode() errors by throwing exceptions with the respective error message. | yii\helpers\BaseJson |
processData() | Pre-processes the data before sending it to json_encode() . |
yii\helpers\BaseJson |