public function encode()
    {
        if (is_null($this->getParameter('value')))
            return '""';

        $value = $this->getParameter('value');
        $index = $this->getParameter('index');

        if($index != null && is_array($value))
            return JSONUtils::encode($value[$index]);

        return JSONUtils::encode($value);
    }
public function encode()
    {
        if (is_null($this->getParameter('value')))
            return '""';

        $value = $this->getParameter('value');
        $index = $this->getParameter('index');

        if($index != null && is_array($value))
            return JSONUtils::encode($value[$index]);

        return JSONUtils::encode($value);
    }
public function encode ( ) { if ( is_null ( $ this -> getParameter ( 'value' ) ) ) return '""' ; $ value = $ this -> getParameter ( 'value' ) ; $ index = $ this -> getParameter ( 'index' ) ; if ( $ index != null && is_array ( $ value ) ) return JSONUtils :: encode ( $ value [ $ index ] ) ; return JSONUtils :: encode ( $ value ) ; }
Escapes the specified parameter in 'value' for use in json

Expected Param:
value mixed  if is a string, this is what will be converted
index string if specified and value is an array, then value[index] will be converted

@return string
Escapes the specified parameter in value for use in json