public function convertToString($data) {
		if (!is_string($data)) {
			$data = @json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
			// Removing null byte and double slashes from object properties
			$data = str_replace(['\\u0000', '\\\\'], ["", "\\"], $data);
		}

		return $data;
	}
public function convertToString($data) {
		if (!is_string($data)) {
			$data = @json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
			// Removing null byte and double slashes from object properties
			$data = str_replace(['\\u0000', '\\\\'], ["", "\\"], $data);
		}

		return $data;
	}
public function convertToString ( $ data ) { if ( ! is_string ( $ data ) ) { $ data = @ json_encode ( $ data , JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) ; // Removing null byte and double slashes from object properties $ data = str_replace ( [ '\\u0000' , '\\\\' ] , [ "" , "\\" ] , $ data ) ; } return $ data ; }
JSON encodes data which isn't already a string and cleans up the result

@todo: could maybe do a better job removing slashes

@param mixed $data

@return string|null
JSON encodes data which isn t already a string and cleans up the result