# UniqueKeyJsonConverter Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.uniquekeyjsonconverter/)

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

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.uniquekeyjsonconverter/methods/read-ref-system-text-json-utf8jsonreader-system-type-system-text-json-jsonserial-fc3c2890/)

[Source](https://github.com/dotnet/orleans/blob/b7a9e3e1c9c54b3cec3a467c5734bf7744541bcf/src/Orleans.Core.Abstractions/IDs/Legacy/UniqueKey.cs#L368-L369)

```csharp
public override UniqueKey? 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.

## ReadAsPropertyName(Utf8JsonReader, Type, JsonSerializerOptions) {#readaspropertyname-ref-system-text-json-utf8jsonreader-system-type-system-text-j-e055c15b}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.uniquekeyjsonconverter/methods/readaspropertyname-ref-system-text-json-utf8jsonreader-system-type-system-text-j-e055c15b/)

[Source](https://github.com/dotnet/orleans/blob/b7a9e3e1c9c54b3cec3a467c5734bf7744541bcf/src/Orleans.Core.Abstractions/IDs/Legacy/UniqueKey.cs#L408-L409)

```csharp
public override UniqueKey ReadAsPropertyName(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
```

Reads a dictionary key from a JSON property name.

### Parameters

- `reader` (`Utf8JsonReader`): The `System.Text.Json.Utf8JsonReader` to read from.
- `typeToConvert` (`Type`): The type to convert.
- `options` (`JsonSerializerOptions`): The options to use when reading the value.

### Returns

The value that was converted.

## Write(Utf8JsonWriter, UniqueKey, JsonSerializerOptions) {#write-system-text-json-utf8jsonwriter-orleans-runtime-uniquekey-system-text-json-94a414b8}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.uniquekeyjsonconverter/methods/write-system-text-json-utf8jsonwriter-orleans-runtime-uniquekey-system-text-json-94a414b8/)

[Source](https://github.com/dotnet/orleans/blob/b7a9e3e1c9c54b3cec3a467c5734bf7744541bcf/src/Orleans.Core.Abstractions/IDs/Legacy/UniqueKey.cs#L403)

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

Writes a specified value as JSON.

### Parameters

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

## WriteAsPropertyName(Utf8JsonWriter, UniqueKey, JsonSerializerOptions) {#writeaspropertyname-system-text-json-utf8jsonwriter-orleans-runtime-uniquekey-sy-ea3e1a16}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.core.abstractions/orleans.runtime.uniquekeyjsonconverter/methods/writeaspropertyname-system-text-json-utf8jsonwriter-orleans-runtime-uniquekey-sy-ea3e1a16/)

[Source](https://github.com/dotnet/orleans/blob/b7a9e3e1c9c54b3cec3a467c5734bf7744541bcf/src/Orleans.Core.Abstractions/IDs/Legacy/UniqueKey.cs#L415-L416)

```csharp
public override void WriteAsPropertyName(Utf8JsonWriter writer, UniqueKey value, JsonSerializerOptions options)
```

Writes a dictionary key as a JSON property name.

### Parameters

- `writer` (`Utf8JsonWriter`): The `System.Text.Json.Utf8JsonWriter` to write to.
- `value` (`UniqueKey`): The value to convert. The value of `System.Text.Json.Serialization.JsonConverter-1.HandleNull` determines if the converter handles `null` values.
- `options` (`JsonSerializerOptions`): The options to use when writing the value.
