xPDO.fromJSON
xPDO::fromJSON
Converts a JSON source string into an equivalent PHP representation.
Syntax
API Docs: http://api.modxcms.com/xpdo/xPDO.html#fromJSON
mixed fromJSON (string $src, [boolean $asArray = true])
Example
Convert JSON code to an array:
$str = '{name:"John"}'; $ar = $xpdo->fromJSON($str); print_r($ar); // prints: Array ( 'name' => 'John' )
See Also
Suggest an edit to this page on GitHub (Requires GitHub account. Opens a new window/tab).