MediaWiki  REL1_19
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, $isHtml=false)
 Returns the JSON representation of a value.

Detailed Description

JSON formatter wrapper class.

Definition at line 17 of file FormatJson.php.


Member Function Documentation

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

Decodes a JSON string.

Parameters:
$valueString: the 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 respectively. is returned if the json cannot be decoded or if the encoded data is deeper than the recursion limit.

Definition at line 55 of file FormatJson.php.

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

Here is the caller graph for this function:

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

Returns the JSON representation of a value.

Parameters:
$valueMixed: the value being encoded. Can be any type except a resource.
$isHtmlBoolean
Todo:
FIXME: "$isHtml" parameter's purpose is not documented. It appears to map to a parameter labeled "pretty-print output with indents and newlines" in Services_JSON::encode(), which has no string relation to HTML output.
Returns:
string

Definition at line 32 of file FormatJson.php.

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

Here is the caller graph for this function:


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