Fellow Oak DICOM
Search Results for

    Show / Hide Table of Contents

    Class DicomJsonConverter

    Converts a DicomDataset object to and from JSON using the System.Text.Json library

    Inheritance
    System.Object
    System.Text.Json.Serialization.JsonConverter
    System.Text.Json.Serialization.JsonConverter<DicomDataset>
    DicomJsonConverter
    Inherited Members
    System.Text.Json.Serialization.JsonConverter<FellowOakDicom.DicomDataset>.ReadAsPropertyName(System.Text.Json.Utf8JsonReader, System.Type, System.Text.Json.JsonSerializerOptions)
    System.Text.Json.Serialization.JsonConverter<FellowOakDicom.DicomDataset>.WriteAsPropertyName(System.Text.Json.Utf8JsonWriter, FellowOakDicom.DicomDataset, System.Text.Json.JsonSerializerOptions)
    System.Text.Json.Serialization.JsonConverter<FellowOakDicom.DicomDataset>.HandleNull
    System.Text.Json.Serialization.JsonConverter<FellowOakDicom.DicomDataset>.Type
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: FellowOakDicom.Serialization
    Assembly: fo-dicom.core.dll
    Syntax
    public class DicomJsonConverter : JsonConverter<DicomDataset>

    Constructors

    DicomJsonConverter(Boolean, Boolean, NumberSerializationMode)

    Initialize the JsonDicomConverter.

    Declaration
    public DicomJsonConverter(bool writeTagsAsKeywords = false, bool autoValidate = true, NumberSerializationMode numberSerializationMode = NumberSerializationMode.AsNumber)
    Parameters
    Type Name Description
    System.Boolean writeTagsAsKeywords

    Whether to write the json keys as DICOM keywords instead of tags. This makes the json non-compliant to DICOM JSON.

    System.Boolean autoValidate

    Whether the content of DicomItems shall be validated when deserializing.

    NumberSerializationMode numberSerializationMode

    Defines how numbers should be serialized. Default 'AsNumber', will throw errors when a number is not parsable.

    Properties

    WriteKeyword

    With his option enabled, Dicom tag keyword will be written as a distinct Json attribute. Note! This is non-standard and may break parsers!

    Declaration
    public bool WriteKeyword { get; set; }
    Property Value
    Type Description
    System.Boolean

    WriteName

    With his option enabled, Dicom tag name will be written as a distinct Json attribute. Note! This is non-standard and may break parsers!

    Declaration
    public bool WriteName { get; set; }
    Property Value
    Type Description
    System.Boolean

    Methods

    CanConvert(Type)

    Determines whether this instance can convert the specified object type.

    Declaration
    public override bool CanConvert(Type typeToConvert)
    Parameters
    Type Name Description
    System.Type typeToConvert
    Returns
    Type Description
    System.Boolean

    true if this instance can convert the specified object type; otherwise, false.

    Overrides
    System.Text.Json.Serialization.JsonConverter<FellowOakDicom.DicomDataset>.CanConvert(System.Type)

    CreateBulkDataUriByteBuffer(String)

    Create an instance of a IBulkDataUriByteBuffer. Override this method to use a different IBulkDataUriByteBuffer implementation in applications.

    Declaration
    protected virtual IBulkDataUriByteBuffer CreateBulkDataUriByteBuffer(string bulkDataUri)
    Parameters
    Type Name Description
    System.String bulkDataUri

    The URI of a bulk data element as defined in Table A.1.5-2 in PS3.19.

    Returns
    Type Description
    IBulkDataUriByteBuffer

    An instance of a Bulk URI Byte buffer.

    Read(ref Utf8JsonReader, Type, JsonSerializerOptions)

    Reads the JSON representation of the object.

    Declaration
    public override DicomDataset Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
    Parameters
    Type Name Description
    System.Text.Json.Utf8JsonReader reader

    The System.Text.Json.Utf8JsonReader to read from.

    System.Type typeToConvert

    Type of the object.

    System.Text.Json.JsonSerializerOptions options

    Options to apply while reading.

    Returns
    Type Description
    DicomDataset

    The object value.

    Overrides
    System.Text.Json.Serialization.JsonConverter<FellowOakDicom.DicomDataset>.Read(System.Text.Json.Utf8JsonReader, System.Type, System.Text.Json.JsonSerializerOptions)

    Write(Utf8JsonWriter, DicomDataset, JsonSerializerOptions)

    Writes the JSON representation of the object.

    Declaration
    public override void Write(Utf8JsonWriter writer, DicomDataset value, JsonSerializerOptions options)
    Parameters
    Type Name Description
    System.Text.Json.Utf8JsonWriter writer

    The System.Text.Json.Utf8JsonWriter to write to.

    DicomDataset value

    The value.

    System.Text.Json.JsonSerializerOptions options
    Overrides
    System.Text.Json.Serialization.JsonConverter<FellowOakDicom.DicomDataset>.Write(System.Text.Json.Utf8JsonWriter, FellowOakDicom.DicomDataset, System.Text.Json.JsonSerializerOptions)

    Extension Methods

    LinqExtensions.IsOneOf<T>(T, T[])
    In This Article
    Back to top Copyright (c) 2012-2025 fo-dicom contributors