Table of Contents

CreateConverter Method

Definition

CreateConverter(Type, JsonSerializerOptions)

Creates a converter for a specified typeToConvert.

public override JsonConverter CreateConverter(Type typeToConvert, JsonSerializerOptions options)

Parameters

typeToConvert Type

The Type being converted.

options JsonSerializerOptions

The JsonSerializerOptions being used.

Returns

JsonConverter

An instance of a JsonConverter<T> where T is compatible with typeToConvert. If null is returned, a NotSupportedException will be thrown.

Remarks

This is an insane reflection implementation due to, IMO, odd design choice by Microsoft (why have separate namingPolicy when PropertyNamingPolicy is already part of options). Personally I like the NamingStrategy found in Newtonsoft.Json better.