Skip to main content

Definition

Assembly: Mintlify.Core.dll Namespace: Mintlify.Core.Converters Inheritance: System.Text.Json.Serialization.JsonConverter<Mintlify.Core.Models.IconConfig>

Syntax

Mintlify.Core.Converters.IconConverter

Summary

Handles JSON conversion for icon properties that can be either strings or objects.

Remarks

Icons in Mintlify can be specified as:
  • String: Simple icon name (e.g., “folder”, “home”)
  • Object: Icon configuration with name, style, and library properties

Constructors

.ctor

Syntax

public IconConverter()

Methods

CanConvert

Determines whether the specified type can be converted by this converter.

Syntax

public override bool CanConvert(System.Type typeToConvert)

Parameters

NameTypeDescription
typeToConvertSystem.TypeThe type to convert.

Returns

Type: bool True if the type is IconConfig; otherwise, false.

Read

Reads and converts the JSON to an IconConfig object.

Syntax

public override Mintlify.Core.Models.IconConfig Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options)

Parameters

NameTypeDescription
readerSystem.Text.Json.Utf8JsonReaderThe JSON reader.
typeToConvertSystem.TypeThe type to convert to.
optionsSystem.Text.Json.JsonSerializerOptionsThe serializer options.

Returns

Type: Mintlify.Core.Models.IconConfig? An IconConfig for both simple icon names and complex icon configurations.

Exceptions

ExceptionDescription
JsonExceptionThrown when the JSON token type is not supported.

Write

Writes the IconConfig object to JSON.

Syntax

public override void Write(System.Text.Json.Utf8JsonWriter writer, Mintlify.Core.Models.IconConfig value, System.Text.Json.JsonSerializerOptions options)

Parameters

NameTypeDescription
writerSystem.Text.Json.Utf8JsonWriterThe JSON writer.
valueMintlify.Core.Models.IconConfig?The IconConfig value to write.
optionsSystem.Text.Json.JsonSerializerOptionsThe serializer options.