0 follower

Class yii\helpers\Json

Inheritanceyii\helpers\Json » yii\helpers\BaseJson
Available since version2.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

Hide inherited properties

PropertyTypeDescriptionDefined By
$jsonErrorMessages array yii\helpers\BaseJson
$prettyPrint boolean|null Enables human readable output a. yii\helpers\BaseJson

Public Methods

Hide inherited methods

MethodDescriptionDefined 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

Hide inherited methods

MethodDescriptionDefined 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