protected function isJsonEncodable($data)
    {
        if (!is_array($data)) {
            $data = [$data];
        }
        $json = json_encode($data, JSON_UNESCAPED_SLASHES);

        if ($json === false) {
            return false;
        }

        return true;
    }
protected function isJsonEncodable($data)
    {
        if (!is_array($data)) {
            $data = [$data];
        }
        $json = json_encode($data, JSON_UNESCAPED_SLASHES);

        if ($json === false) {
            return false;
        }

        return true;
    }
protected function isJsonEncodable ( $ data ) { if ( ! is_array ( $ data ) ) { $ data = [ $ data ] ; } $ json = json_encode ( $ data , JSON_UNESCAPED_SLASHES ) ; if ( $ json === false ) { return false ; } return true ; }
Checks to see if a string can be json encoded.

@param string $data

@return bool
Checks to see if a string can be json encoded .