#### [Abblix\.SecurityEvents](https://www.abblix.com/en/docs/api/abblix-securityevents 'index')
### [Abblix\.SecurityEvents\.Subjects](https://www.abblix.com/en/docs/api/abblix-securityevents/Abblix.SecurityEvents.Subjects 'Abblix\.SecurityEvents\.Subjects')

## SubjectIdentifierJsonConverter Class

Reads and writes a [SubjectIdentifier](https://www.abblix.com/en/docs/api/abblix-securityevents/Abblix.SecurityEvents.Subjects.SubjectIdentifier 'Abblix\.SecurityEvents\.Subjects\.SubjectIdentifier') polymorphically, choosing the concrete
subtype by the "format" member that RFC 9493 Section 3 requires every Subject Identifier to
carry\.

```csharp
public sealed class SubjectIdentifierJsonConverter : System.Text.Json.Serialization.JsonConverter<Abblix.SecurityEvents.Subjects.SubjectIdentifier>
```

Inheritance [System\.Object](https://learn.microsoft.com/en-us/dotnet/api/system.object 'System\.Object') → [System\.Text\.Json\.Serialization\.JsonConverter](https://learn.microsoft.com/en-us/dotnet/api/system.text.json.serialization.jsonconverter 'System\.Text\.Json\.Serialization\.JsonConverter') → [System\.Text\.Json\.Serialization\.JsonConverter&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.text.json.serialization.jsonconverter-1 'System\.Text\.Json\.Serialization\.JsonConverter\`1')[SubjectIdentifier](https://www.abblix.com/en/docs/api/abblix-securityevents/Abblix.SecurityEvents.Subjects.SubjectIdentifier 'Abblix\.SecurityEvents\.Subjects\.SubjectIdentifier')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.text.json.serialization.jsonconverter-1 'System\.Text\.Json\.Serialization\.JsonConverter\`1') → SubjectIdentifierJsonConverter

### Remarks

The converter is attached to [SubjectIdentifier](https://www.abblix.com/en/docs/api/abblix-securityevents/Abblix.SecurityEvents.Subjects.SubjectIdentifier 'Abblix\.SecurityEvents\.Subjects\.SubjectIdentifier') itself, so it is reached whenever
the declared type is the abstract base - the nested identifiers of an
[AliasesSubject](https://www.abblix.com/en/docs/api/abblix-securityevents/Abblix.SecurityEvents.Subjects.AliasesSubject 'Abblix\.SecurityEvents\.Subjects\.AliasesSubject') among them - and is not reached when the declared type is already
a concrete subtype. That asymmetry is what lets [Write\(Utf8JsonWriter, SubjectIdentifier, JsonSerializerOptions\)](https://www.abblix.com/en/docs/api/abblix-securityevents/Abblix.SecurityEvents.Subjects.SubjectIdentifierJsonConverter#Abblix.SecurityEvents.Subjects.SubjectIdentifierJsonConverter.Write(System.Text.Json.Utf8JsonWriter,Abblix.SecurityEvents.Subjects.SubjectIdentifier,System.Text.Json.JsonSerializerOptions) 'Abblix\.SecurityEvents\.Subjects\.SubjectIdentifierJsonConverter\.Write\(System\.Text\.Json\.Utf8JsonWriter, Abblix\.SecurityEvents\.Subjects\.SubjectIdentifier, System\.Text\.Json\.JsonSerializerOptions\)') hand the value straight back
to the serializer under its runtime type without re-entering this converter.

A format outside the built-in vocabulary is supported by deriving from
[SubjectIdentifier](https://www.abblix.com/en/docs/api/abblix-securityevents/Abblix.SecurityEvents.Subjects.SubjectIdentifier 'Abblix\.SecurityEvents\.Subjects\.SubjectIdentifier') and naming the subtype in the custom-formats map of
[SubjectIdentifierJsonConverter\(IReadOnlyDictionary&lt;string,Type&gt;\)](https://www.abblix.com/en/docs/api/abblix-securityevents/Abblix.SecurityEvents.Subjects.SubjectIdentifierJsonConverter#Abblix.SecurityEvents.Subjects.SubjectIdentifierJsonConverter.SubjectIdentifierJsonConverter(System.Collections.Generic.IReadOnlyDictionary_string,System.Type_) 'Abblix\.SecurityEvents\.Subjects\.SubjectIdentifierJsonConverter\.SubjectIdentifierJsonConverter\(System\.Collections\.Generic\.IReadOnlyDictionary\<string,System\.Type\>\)'), then placing
the resulting converter in the serializer options. Registration happens once, when the
converter is built, so the map cannot change under a reader mid-flight.
### Constructors

## SubjectIdentifierJsonConverter\(\) Constructor {#Abblix.SecurityEvents.Subjects.SubjectIdentifierJsonConverter.SubjectIdentifierJsonConverter()}

Creates a converter that understands the built\-in vocabulary: the formats of the IANA
registry \(RFC 9493 Section 8\.1\.2\) and the SSF 1\.0 extensions \(Sections 3\.3, 3\.5\)\.

```csharp
public SubjectIdentifierJsonConverter();
```

## SubjectIdentifierJsonConverter\(IReadOnlyDictionary\<string,Type\>\) Constructor {#Abblix.SecurityEvents.Subjects.SubjectIdentifierJsonConverter.SubjectIdentifierJsonConverter(System.Collections.Generic.IReadOnlyDictionary_string,System.Type_)}

Creates a converter that understands the built\-in vocabulary plus the formats given\.

```csharp
public SubjectIdentifierJsonConverter(System.Collections.Generic.IReadOnlyDictionary<string,System.Type>? customFormats);
```
#### Parameters

###### `customFormats` [System\.Collections\.Generic\.IReadOnlyDictionary&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ireadonlydictionary-2 'System\.Collections\.Generic\.IReadOnlyDictionary\`2')[System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String')[,](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ireadonlydictionary-2 'System\.Collections\.Generic\.IReadOnlyDictionary\`2')[System\.Type](https://learn.microsoft.com/en-us/dotnet/api/system.type 'System\.Type')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ireadonlydictionary-2 'System\.Collections\.Generic\.IReadOnlyDictionary\`2') {#Abblix.SecurityEvents.Subjects.SubjectIdentifierJsonConverter.SubjectIdentifierJsonConverter(System.Collections.Generic.IReadOnlyDictionary_string,System.Type_).customFormats}

Format names mapped to the concrete [SubjectIdentifier](https://www.abblix.com/en/docs/api/abblix-securityevents/Abblix.SecurityEvents.Subjects.SubjectIdentifier 'Abblix\.SecurityEvents\.Subjects\.SubjectIdentifier') subtype that models
them\. A name from the built\-in vocabulary cannot be redefined here: those formats are the
shared vocabulary of their specifications, and quietly rebinding one would make two
parties disagree about a document both consider valid\.

#### Exceptions

[System\.ArgumentException](https://learn.microsoft.com/en-us/dotnet/api/system.argumentexception 'System\.ArgumentException')  
A name is null or empty, collides with the built\-in vocabulary, or is mapped to a type
that is not a concrete subclass of [SubjectIdentifier](https://www.abblix.com/en/docs/api/abblix-securityevents/Abblix.SecurityEvents.Subjects.SubjectIdentifier 'Abblix\.SecurityEvents\.Subjects\.SubjectIdentifier')\.
### Methods

## SubjectIdentifierJsonConverter\.CanConvert\(Type\) Method {#Abblix.SecurityEvents.Subjects.SubjectIdentifierJsonConverter.CanConvert(System.Type)}

Claims exactly the abstract base type and never a concrete subtype\.

```csharp
public override bool CanConvert(System.Type typeToConvert);
```
#### Parameters

###### `typeToConvert` [System\.Type](https://learn.microsoft.com/en-us/dotnet/api/system.type 'System\.Type') {#Abblix.SecurityEvents.Subjects.SubjectIdentifierJsonConverter.CanConvert(System.Type).typeToConvert}

#### Returns
[System\.Boolean](https://learn.microsoft.com/en-us/dotnet/api/system.boolean 'System\.Boolean')

### Remarks
Both [Read\(Utf8JsonReader, Type, JsonSerializerOptions\)](https://www.abblix.com/en/docs/api/abblix-securityevents/Abblix.SecurityEvents.Subjects.SubjectIdentifierJsonConverter#Abblix.SecurityEvents.Subjects.SubjectIdentifierJsonConverter.Read(System.Text.Json.Utf8JsonReader,System.Type,System.Text.Json.JsonSerializerOptions) 'Abblix\.SecurityEvents\.Subjects\.SubjectIdentifierJsonConverter\.Read\(System\.Text\.Json\.Utf8JsonReader, System\.Type, System\.Text\.Json\.JsonSerializerOptions\)') and [Write\(Utf8JsonWriter, SubjectIdentifier, JsonSerializerOptions\)](https://www.abblix.com/en/docs/api/abblix-securityevents/Abblix.SecurityEvents.Subjects.SubjectIdentifierJsonConverter#Abblix.SecurityEvents.Subjects.SubjectIdentifierJsonConverter.Write(System.Text.Json.Utf8JsonWriter,Abblix.SecurityEvents.Subjects.SubjectIdentifier,System.Text.Json.JsonSerializerOptions) 'Abblix\.SecurityEvents\.Subjects\.SubjectIdentifierJsonConverter\.Write\(System\.Text\.Json\.Utf8JsonWriter, Abblix\.SecurityEvents\.Subjects\.SubjectIdentifier, System\.Text\.Json\.JsonSerializerOptions\)') re\-enter the serializer under the concrete
subtype, and they terminate only because that request is NOT routed back here\. The base
implementation currently answers with exact type equality, which provides that guarantee,
but the guarantee is this converter's termination condition, so it is stated here rather
than inherited from behaviour that lives only in convention\.

## SubjectIdentifierJsonConverter\.Read\(Utf8JsonReader, Type, JsonSerializerOptions\) Method {#Abblix.SecurityEvents.Subjects.SubjectIdentifierJsonConverter.Read(System.Text.Json.Utf8JsonReader,System.Type,System.Text.Json.JsonSerializerOptions)}

Reads a Subject Identifier, dispatching on its "format" member to the subtype that models
that Identifier Format\.

```csharp
public override Abblix.SecurityEvents.Subjects.SubjectIdentifier? Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options);
```
#### Parameters

###### `reader` [System\.Text\.Json\.Utf8JsonReader](https://learn.microsoft.com/en-us/dotnet/api/system.text.json.utf8jsonreader 'System\.Text\.Json\.Utf8JsonReader') {#Abblix.SecurityEvents.Subjects.SubjectIdentifierJsonConverter.Read(System.Text.Json.Utf8JsonReader,System.Type,System.Text.Json.JsonSerializerOptions).reader}

###### `typeToConvert` [System\.Type](https://learn.microsoft.com/en-us/dotnet/api/system.type 'System\.Type') {#Abblix.SecurityEvents.Subjects.SubjectIdentifierJsonConverter.Read(System.Text.Json.Utf8JsonReader,System.Type,System.Text.Json.JsonSerializerOptions).typeToConvert}

###### `options` [System\.Text\.Json\.JsonSerializerOptions](https://learn.microsoft.com/en-us/dotnet/api/system.text.json.jsonserializeroptions 'System\.Text\.Json\.JsonSerializerOptions') {#Abblix.SecurityEvents.Subjects.SubjectIdentifierJsonConverter.Read(System.Text.Json.Utf8JsonReader,System.Type,System.Text.Json.JsonSerializerOptions).options}

#### Returns
[SubjectIdentifier](https://www.abblix.com/en/docs/api/abblix-securityevents/Abblix.SecurityEvents.Subjects.SubjectIdentifier 'Abblix\.SecurityEvents\.Subjects\.SubjectIdentifier')

#### Exceptions

[System\.Text\.Json\.JsonException](https://learn.microsoft.com/en-us/dotnet/api/system.text.json.jsonexception 'System\.Text\.Json\.JsonException')  
The value is not a JSON object, carries no usable "format" member, names a format this
converter has not been told about, or holds members its Identifier Format does not permit\.
The subtype constructors enforce the member rules and throw [System\.ArgumentException](https://learn.microsoft.com/en-us/dotnet/api/system.argumentexception 'System\.ArgumentException');
this boundary translates that into the exception type callers of a deserializer guard
against, so untrusted input fails with one exception type however it is malformed\.

## SubjectIdentifierJsonConverter\.Write\(Utf8JsonWriter, SubjectIdentifier, JsonSerializerOptions\) Method {#Abblix.SecurityEvents.Subjects.SubjectIdentifierJsonConverter.Write(System.Text.Json.Utf8JsonWriter,Abblix.SecurityEvents.Subjects.SubjectIdentifier,System.Text.Json.JsonSerializerOptions)}

Writes a Subject Identifier in the shape its own Identifier Format defines, "format" member
included\.

```csharp
public override void Write(System.Text.Json.Utf8JsonWriter writer, Abblix.SecurityEvents.Subjects.SubjectIdentifier value, System.Text.Json.JsonSerializerOptions options);
```
#### Parameters

###### `writer` [System\.Text\.Json\.Utf8JsonWriter](https://learn.microsoft.com/en-us/dotnet/api/system.text.json.utf8jsonwriter 'System\.Text\.Json\.Utf8JsonWriter') {#Abblix.SecurityEvents.Subjects.SubjectIdentifierJsonConverter.Write(System.Text.Json.Utf8JsonWriter,Abblix.SecurityEvents.Subjects.SubjectIdentifier,System.Text.Json.JsonSerializerOptions).writer}

###### `value` [SubjectIdentifier](https://www.abblix.com/en/docs/api/abblix-securityevents/Abblix.SecurityEvents.Subjects.SubjectIdentifier 'Abblix\.SecurityEvents\.Subjects\.SubjectIdentifier') {#Abblix.SecurityEvents.Subjects.SubjectIdentifierJsonConverter.Write(System.Text.Json.Utf8JsonWriter,Abblix.SecurityEvents.Subjects.SubjectIdentifier,System.Text.Json.JsonSerializerOptions).value}

<a id="Abblix.SecurityEvents.Subjects.SubjectIdentifierJsonConverter.Write(System.Text.Json.Utf8JsonWriter,Abblix.SecurityEvents.Subjects.SubjectIdentifier,System.Text.Json.JsonSerializerOptions).options"></a>

`options` [System\.Text\.Json\.JsonSerializerOptions](https://learn.microsoft.com/en-us/dotnet/api/system.text.json.jsonserializeroptions 'System\.Text\.Json\.JsonSerializerOptions')
