# GrainReferenceConverter Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.core/orleans.serialization.grainreferenceconverter/)

## CanConvert(Type) {#canconvert-system-type-7923a284}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core/orleans.serialization.grainreferenceconverter/methods/canconvert-system-type-7923a284/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Core/Serialization/SystemTextJson/GrainReferenceConverter.cs#L20)

```csharp
public override bool CanConvert(Type typeToConvert)
```

Determines whether the specified type can be converted.

### Parameters

- `typeToConvert` (`Type`): The type to compare against.

### Returns

`true` if the type can be converted; otherwise, `false`.

## Read(Utf8JsonReader, Type, JsonSerializerOptions) {#read-ref-system-text-json-utf8jsonreader-system-type-system-text-json-jsonserial-7579b9ad}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core/orleans.serialization.grainreferenceconverter/methods/read-ref-system-text-json-utf8jsonreader-system-type-system-text-json-jsonserial-7579b9ad/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Core/Serialization/SystemTextJson/GrainReferenceConverter.cs#L25-L52)

```csharp
public override IAddressable? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
```

Reads and converts the JSON to type `T`.

### Parameters

- `reader` (`Utf8JsonReader`): The reader.
- `typeToConvert` (`Type`): The type to convert.
- `options` (`JsonSerializerOptions`): An object that specifies serialization options to use.

### Returns

The converted value.

## Write(Utf8JsonWriter, IAddressable, JsonSerializerOptions) {#write-system-text-json-utf8jsonwriter-orleans-runtime-iaddressable-system-text-j-06cbe447}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core/orleans.serialization.grainreferenceconverter/methods/write-system-text-json-utf8jsonwriter-orleans-runtime-iaddressable-system-text-j-06cbe447/)

[Source](https://github.com/dotnet/orleans/blob/6a0e937f544c35ffcf11b37e4c2b7de5a1580a03/src/Orleans.Core/Serialization/SystemTextJson/GrainReferenceConverter.cs#L58-L63)

```csharp
public override void Write(Utf8JsonWriter writer, IAddressable value, JsonSerializerOptions options)
```

Writes a specified value as JSON.

### Parameters

- `writer` (`Utf8JsonWriter`): The writer to write to.
- `value` (`IAddressable`): The value to convert to JSON.
- `options` (`JsonSerializerOptions`): An object that specifies serialization options to use.
