toJSON
Last updated Apr 6th, 2019 | Page history | Improve this page | Report an issue
xPDOObject::toJSON()¶
Returns a JSON representation of the object.
Syntax¶
API Docs: http://api.modxcms.com/xpdo/om/xPDOObject.html#toJSON
string toJSON (
[string $keyPrefix = ''],
[boolean $rawValues = false]
)
Example¶
$object->set('name','Bob');
$object->set('email','pinkdaisies@gmail.com');
$json = $object->toJSON();
echo $json;
// prints {"name":"Bob","email":"pinkdaisies@gmail.com"}