I expect it should work:
```
:) select CAST(CAST('{"x" : 1}', 'Object(\'json\')'), 'Object(Nullable(\'json\'))')

SELECT CAST(CAST('{"x" : 1}', 'Object(\'json\')'), 'Object(Nullable(\'json\'))')

Query id: fb057b45-b72a-4d22-9b38-a3136cdf2465


0 rows in set. Elapsed: 0.002 sec.

Received exception from server (version 22.5.1):
Code: 53. DB::Exception: Received from localhost:9000. DB::Exception: Cast to Object can be performed only from flatten named Tuple, Map or String. Got: Object('json'): While processing CAST(CAST('{"x" : 1}', 'Object(\'json\')'), 'Object(Nullable(\'json\'))'). (TYPE_MISMATCH)
```

@CurtizJ what do you think?
{
        auto key_value_types = from_map.getKeyValueTypes();
        if (!isStringOrFixedString(key_value_types[0]))
            throw Exception(ErrorCodes::TYPE_MISMATCH,
                "Cast to Object from Map can be performed only from Map "
                "with String or FixedString key. Got: {}", from_map.getName());
        const auto & value_type = key_value_types[1];
        auto to_value_type = value_type;
        if (!has_nullable_subcolumns && value_type->isNullable())
            to_value_type = removeNullable(value_type);
        if (has_nullable_subcolumns && !value_type->isNullable())
            to_value_type = makeNullable(value_type);
        DataTypes to_key_value_types{std::make_shared<DataTypeString>(), std::move(to_value_type)};
        auto element_wrappers = getElementWrappers(key_value_types, to_key_value_types);
        return [has_nullable_subcolumns, element_wrappers, key_value_types, to_key_value_types]
            (ColumnsWithTypeAndName & arguments, const DataTypePtr &, const ColumnNullable * nullable_source, size_t) -> ColumnPtr
        {
            const auto & column_map = assert_cast<const ColumnMap &>(*arguments.front().column);
            const auto & offsets = column_map.getNestedColumn().getOffsets();
            auto key_value_columns = column_map.getNestedData().getColumnsCopy();
            for (size_t i = 0; i < 2; ++i)
            {
                ColumnsWithTypeAndName element{{key_value_columns[i], key_value_types[i], ""}};
                key_value_columns[i] = element_wrappers[i](element, to_key_value_types[i], nullable_source, key_value_columns[i]->size());
            }
            const auto & key_column_str = assert_cast<const ColumnString &>(*key_value_columns[0]);
            const auto & value_column = *key_value_columns[1];
            using SubcolumnsMap = HashMap<StringRef, MutableColumnPtr, StringRefHash>;
            SubcolumnsMap subcolumns;