Jump to main content Jump to doc navigation

xPDO::toJSON

Converts a PHP array into a JSON encoded string.

Syntax

API Docs: http://api.modxcms.com/xpdo/xPDO.html#toJSON

string toJSON (array $array)

Example

$ar = array('name' => 'John');
$str = $xpdo->toJSON($ar);
echo $str; // prints: {name:"John"}

See Also