public function value($val = [], $quoteString = null, $key = 'value') {
		if ($quoteString === null) {
			$quoteString = true;
		}
		switch (true) {
			case (is_array($val) || is_object($val)):
				$val = $this->object($val);
				break;
			case ($val === null):
				$val = 'null';
				break;
			case (is_bool($val)):
				$val = ($val === true) ? 'true' : 'false';
				break;
			case (is_int($val)):
				break;
			case (is_float($val)):
				$val = sprintf('%.11f', $val);
				break;
			default:
				$val = $this->escape($val);
				if ($quoteString) {
					$val = '"' . $val . '"';
				}
		}
		return $val;
	}
public function value($val = [], $quoteString = null, $key = 'value') {
		if ($quoteString === null) {
			$quoteString = true;
		}
		switch (true) {
			case (is_array($val) || is_object($val)):
				$val = $this->object($val);
				break;
			case ($val === null):
				$val = 'null';
				break;
			case (is_bool($val)):
				$val = ($val === true) ? 'true' : 'false';
				break;
			case (is_int($val)):
				break;
			case (is_float($val)):
				$val = sprintf('%.11f', $val);
				break;
			default:
				$val = $this->escape($val);
				if ($quoteString) {
					$val = '"' . $val . '"';
				}
		}
		return $val;
	}
public function value ( $ val = [ ] , $ quoteString = null , $ key = 'value' ) { if ( $ quoteString === null ) { $ quoteString = true ; } switch ( true ) { case ( is_array ( $ val ) || is_object ( $ val ) ) : $ val = $ this -> object ( $ val ) ; break ; case ( $ val === null ) : $ val = 'null' ; break ; case ( is_bool ( $ val ) ) : $ val = ( $ val === true ) ? 'true' : 'false' ; break ; case ( is_int ( $ val ) ) : break ; case ( is_float ( $ val ) ) : $ val = sprintf ( '%.11f' , $ val ) ; break ; default : $ val = $ this -> escape ( $ val ) ; if ( $ quoteString ) { $ val = '"' . $ val . '"' ; } } return $ val ; }
Converts a PHP-native variable of any type to a JSON-equivalent representation

@param mixed $val A PHP variable to be converted to JSON
@param bool|null $quoteString If false, leaves string values unquoted
@param string $key Key name.
@return string a JavaScript-safe/JSON representation of $val
Converts a PHP - native variable of any type to a JSON - equivalent representation