MediaWiki  REL1_21
FormatJson Class Reference

JSON formatter wrapper class. More...

List of all members.

Static Public Member Functions

static decode ($value, $assoc=false)
 Decodes a JSON string.
static encode ($value, $pretty=false)
 Returns the JSON representation of a value.

Detailed Description

JSON formatter wrapper class.

Definition at line 28 of file FormatJson.php.


Member Function Documentation

static FormatJson::decode ( value,
assoc = false 
) [static]

Decodes a JSON string.

Parameters:
string$valuethe json string being decoded.
$assocBoolean: when true, returned objects will be converted into associative arrays.
Returns:
Mixed: the value encoded in json in appropriate PHP type. Values true, false and null (case-insensitive) are returned as true, false and "&null;" respectively. "&null;" is returned if the json cannot be decoded or if the encoded data is deeper than the recursion limit.

Definition at line 58 of file FormatJson.php.

References $value.

Referenced by ForeignAPIRepo\fetchImageQuery(), ResourceLoaderModule\getFileDependencies(), MessageBlobStore\getFromDB(), MediaWikiSite\normalizePageName(), ResourceLoader\preloadModuleInfo(), MessageBlobStore\reencodeBlob(), JsonTest\testDecodeVarTypes(), and MessageBlobStore\updateModule().

static FormatJson::encode ( value,
pretty = false 
) [static]

Returns the JSON representation of a value.

Parameters:
$valueMixed: the value being encoded. Can be any type except a resource.
$prettyBoolean: If true, adds non-significant whitespace to improve readability.
Returns:
string

Definition at line 38 of file FormatJson.php.

References $value.

Referenced by GetConfiguration\execute(), ApiFormatJson\execute(), MessageBlobStore\generateMessageBlob(), ResourceLoaderFileModule\getStyles(), MessageBlobStore\reencodeBlob(), JsonTest\testPhpBug46944Test(), and GenerateJqueryMsgData\writeJavascriptFile().


The documentation for this class was generated from the following file: