Class DatasetIdJsonConverter
Serialises DatasetId as a bare JSON string so that the
identifier round-trips symmetrically: every tool accepts a plain
string datasetId argument, and every tool result therefore
emits the same plain string rather than a wrapped
{"value":"…"} object.
public sealed class DatasetIdJsonConverter : JsonConverter<DatasetId>
- Inheritance
-
DatasetIdJsonConverter
- Inherited Members
Remarks
On read the converter is lenient — it accepts either a bare string
(the canonical form) or the legacy {"value":"…"} object — so
that any caller or persisted payload using the older wrapped shape
continues to bind. On write it always emits the bare string.
Methods
Read(ref Utf8JsonReader, Type, JsonSerializerOptions)
Reads and converts the JSON to type DatasetId.
public override DatasetId Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
Parameters
readerUtf8JsonReaderThe reader.
typeToConvertTypeThe type to convert.
optionsJsonSerializerOptionsAn object that specifies serialization options to use.
Returns
- DatasetId
The converted value.
ReadAsPropertyName(ref Utf8JsonReader, Type, JsonSerializerOptions)
Reads a dictionary key from a JSON property name.
public override DatasetId ReadAsPropertyName(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
Parameters
readerUtf8JsonReaderThe Utf8JsonReader to read from.
typeToConvertTypeThe type to convert.
optionsJsonSerializerOptionsThe options to use when reading the value.
Returns
- DatasetId
The value that was converted.
Write(Utf8JsonWriter, DatasetId, JsonSerializerOptions)
Writes a specified value as JSON.
public override void Write(Utf8JsonWriter writer, DatasetId value, JsonSerializerOptions options)
Parameters
writerUtf8JsonWriterThe writer to write to.
valueDatasetIdThe value to convert to JSON.
optionsJsonSerializerOptionsAn object that specifies serialization options to use.
WriteAsPropertyName(Utf8JsonWriter, DatasetId, JsonSerializerOptions)
Writes a dictionary key as a JSON property name.
public override void WriteAsPropertyName(Utf8JsonWriter writer, DatasetId value, JsonSerializerOptions options)
Parameters
writerUtf8JsonWriterThe Utf8JsonWriter to write to.
valueDatasetIdThe value to convert. The value of HandleNull determines if the converter handles null values.
optionsJsonSerializerOptionsThe options to use when writing the value.