This is the documentation for concrete5 version 5.6 and earlier. View Current Documentation

The JSON helper is useful when working with data that needs to be decoded from or encoded to the JSON format. You can learn more about JSON here.

concrete5 uses JSON to communicate between the dashboard sitemap and the backend, and to/from the concrete5 marketplace.

Loading the Helper

$js = Loader::helper('json');

Methods

$r = $js->decode($string, $as_array = false)

Decodes a string of JSON data into a PHP object or array. By default, the JSON data is decoded into an object. Setting the optional second parameter true will return an associative array.

$r = $js->encode($item)

Encodes a PHP object or array $item into a JSON string and returns it.

Loading Conversation