API16

API16:JRegistryFormatJSON/objectToString

From Joomla! Documentation

Revision as of 02:00, 25 March 2017 by JoomlaWikiBot (talk | contribs) (preparing for archive only)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Description

Converts an object into a JSON formatted string. Unfortunately, there is no way to have ini values nested further than two levels deep. Therefore we will only go through the first two levels of the object.




Syntax

objectToString($object, $params)
Parameter Name Default Value Description
$object Data source object.
$params Options used by the formatter.

Returns

string JSON formatted string.

Defined in

libraries/joomla/registry/format/json.php

Importing

jimport( 'joomla.registry.format.json' );

Source Body

public function objectToString($object, $params)
{
        return json_encode($object);
}



Examples

Code Examples