Definition

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

Syntax

Mintlify.Core.Converters.PrimaryNavigationConverter

Summary

Handles JSON conversion for primary navigation properties that can be different types of objects.

Remarks

Primary navigation in Mintlify NavbarConfig can be specified as:
  • Object: Button configuration with type, label, and href properties
  • Object: GitHub configuration with type and href properties
  • Object: Other custom navigation configurations

Constructors

.ctor

Syntax

public PrimaryNavigationConverter()

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 object; otherwise, false.

Read

Reads and converts the JSON to a primary navigation object.

Syntax

public override object 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: object? A Dictionary for primary navigation configuration objects.

Exceptions

ExceptionDescription
JsonExceptionThrown when the JSON token type is not supported.

Write

Writes the primary navigation object to JSON.

Syntax

public override void Write(System.Text.Json.Utf8JsonWriter writer, object value, System.Text.Json.JsonSerializerOptions options)

Parameters

NameTypeDescription
writerSystem.Text.Json.Utf8JsonWriterThe JSON writer.
valueobjectThe value to write.
optionsSystem.Text.Json.JsonSerializerOptionsThe serializer options.

Exceptions

ExceptionDescription
JsonExceptionThrown when the value type is not supported.