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 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
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
processData() Pre-processes the data before sending it to json_encode(). yii\helpers\BaseJson