public static function get_json_error()
    {
        $error = 'JSON - ';

        switch (json_last_error()) {
            case JSON_ERROR_NONE:
                $error = false;
                break;

            case JSON_ERROR_DEPTH:
                $error .= 'The maximum stack depth has been exceeded.';
                break;

            case JSON_ERROR_STATE_MISMATCH:
                $error .= 'Invalid or malformed JSON.';
                break;

            case JSON_ERROR_CTRL_CHAR:
                $error .= 'Control character error, possibly incorrectly encoded.';
                break;

            case JSON_ERROR_SYNTAX:
                $error .= 'Syntax error.';
                break;

            default:
                $error .= 'Unknown error (' . json_last_error() . ').';
                break;
        }

        return $error;
    }