<PackageReference Include="System.Text.Json" Version="8.0.0-preview.2.23128.3" />

JsonMetadataServices

public static class JsonMetadataServices
Provides helpers to create and initialize metadata for JSON-serializable types.
public static JsonConverter<bool> BooleanConverter { get; }

Returns a JsonConverter<T> instance that converts Boolean values.

public static JsonConverter<byte[]> ByteArrayConverter { get; }

Returns a JsonConverter<T> instance that converts byte array values.

public static JsonConverter<byte> ByteConverter { get; }

Returns a JsonConverter<T> instance that converts Byte values.

public static JsonConverter<char> CharConverter { get; }

Returns a JsonConverter<T> instance that converts Char values.

public static JsonConverter<DateTime> DateTimeConverter { get; }

Returns a JsonConverter<T> instance that converts DateTime values.

Returns a JsonConverter<T> instance that converts DateTimeOffset values.

public static JsonConverter<decimal> DecimalConverter { get; }

Returns a JsonConverter<T> instance that converts Decimal values.

public static JsonConverter<double> DoubleConverter { get; }

Returns a JsonConverter<T> instance that converts Double values.

public static JsonConverter<Guid> GuidConverter { get; }

Returns a JsonConverter<T> instance that converts Guid values.

public static JsonConverter<short> Int16Converter { get; }

Returns a JsonConverter<T> instance that converts Int16 values.

public static JsonConverter<int> Int32Converter { get; }

Returns a JsonConverter<T> instance that converts Int32 values.

public static JsonConverter<long> Int64Converter { get; }

Returns a JsonConverter<T> instance that converts Int64 values.

public static JsonConverter<JsonArray> JsonArrayConverter { get; }

Returns a JsonConverter<T> instance that converts JsonArray values.

Returns a JsonConverter<T> instance that converts JsonDocument values.

Returns a JsonConverter<T> instance that converts JsonElement values.

public static JsonConverter<JsonNode> JsonNodeConverter { get; }

Returns a JsonConverter<T> instance that converts JsonNode values.

Returns a JsonConverter<T> instance that converts JsonObject values.

public static JsonConverter<JsonValue> JsonValueConverter { get; }

Returns a JsonConverter<T> instance that converts JsonArray values.

public static JsonConverter<object> ObjectConverter { get; }

Returns a JsonConverter<T> instance that converts Object values.

public static JsonConverter<sbyte> SByteConverter { get; }

Returns a JsonConverter<T> instance that converts SByte values.

public static JsonConverter<float> SingleConverter { get; }

Returns a JsonConverter<T> instance that converts Single values.

public static JsonConverter<string> StringConverter { get; }

Returns a JsonConverter<T> instance that converts String values.

public static JsonConverter<TimeSpan> TimeSpanConverter { get; }

Returns a JsonConverter<T> instance that converts TimeSpan values.

public static JsonConverter<ushort> UInt16Converter { get; }

Returns a JsonConverter<T> instance that converts UInt16 values.

public static JsonConverter<uint> UInt32Converter { get; }

Returns a JsonConverter<T> instance that converts UInt32 values.

public static JsonConverter<ulong> UInt64Converter { get; }

Returns a JsonConverter<T> instance that converts UInt64 values.

public static JsonConverter<Uri> UriConverter { get; }

Returns a JsonConverter<T> instance that converts Uri values.

public static JsonConverter<Version> VersionConverter { get; }

Returns a JsonConverter<T> instance that converts Version values.

public static JsonTypeInfo<TElement[]> CreateArrayInfo<TElement>(JsonSerializerOptions options, JsonCollectionInfoValues<TElement[]> collectionInfo)

Creates serialization metadata for an array.

public static JsonTypeInfo<TCollection> CreateConcurrentQueueInfo<TCollection, TElement>(JsonSerializerOptions options, JsonCollectionInfoValues<TCollection> collectionInfo) where TCollection : ConcurrentQueue<TElement>

Creates serialization metadata for types assignable to Queue<T>.

public static JsonTypeInfo<TCollection> CreateConcurrentStackInfo<TCollection, TElement>(JsonSerializerOptions options, JsonCollectionInfoValues<TCollection> collectionInfo) where TCollection : ConcurrentStack<TElement>

Creates serialization metadata for types assignable to ConcurrentStack<T>.

public static JsonTypeInfo<TCollection> CreateDictionaryInfo<TCollection, TKey, TValue>(JsonSerializerOptions options, JsonCollectionInfoValues<TCollection> collectionInfo) where TCollection : Dictionary<TKey, TValue>

Creates serialization metadata for types assignable to Dictionary<T, U>.

public static JsonTypeInfo<TCollection> CreateIAsyncEnumerableInfo<TCollection, TElement>(JsonSerializerOptions options, JsonCollectionInfoValues<TCollection> collectionInfo) where TCollection : IAsyncEnumerable<TElement>

Creates serialization metadata for types assignable to IAsyncEnumerable<T>.

public static JsonTypeInfo<TCollection> CreateICollectionInfo<TCollection, TElement>(JsonSerializerOptions options, JsonCollectionInfoValues<TCollection> collectionInfo) where TCollection : ICollection<TElement>

Creates serialization metadata for types assignable to ICollection<T>.

public static JsonTypeInfo<TCollection> CreateIDictionaryInfo<TCollection, TKey, TValue>(JsonSerializerOptions options, JsonCollectionInfoValues<TCollection> collectionInfo) where TCollection : IDictionary<TKey, TValue>

Creates serialization metadata for types assignable to IDictionary<T, U>.

public static JsonTypeInfo<TCollection> CreateIDictionaryInfo<TCollection>(JsonSerializerOptions options, JsonCollectionInfoValues<TCollection> collectionInfo) where TCollection : IDictionary

Creates serialization metadata for types assignable to IDictionary.

public static JsonTypeInfo<TCollection> CreateIEnumerableInfo<TCollection, TElement>(JsonSerializerOptions options, JsonCollectionInfoValues<TCollection> collectionInfo) where TCollection : IEnumerable<TElement>

Creates serialization metadata for types assignable to IEnumerable<T>.

public static JsonTypeInfo<TCollection> CreateIEnumerableInfo<TCollection>(JsonSerializerOptions options, JsonCollectionInfoValues<TCollection> collectionInfo) where TCollection : IEnumerable

Creates serialization metadata for types assignable to IList.

public static JsonTypeInfo<TCollection> CreateIListInfo<TCollection>(JsonSerializerOptions options, JsonCollectionInfoValues<TCollection> collectionInfo) where TCollection : IList

Creates serialization metadata for types assignable to IList.

public static JsonTypeInfo<TCollection> CreateIListInfo<TCollection, TElement>(JsonSerializerOptions options, JsonCollectionInfoValues<TCollection> collectionInfo) where TCollection : IList<TElement>

Creates serialization metadata for types assignable to IList<T>.

public static JsonTypeInfo<TCollection> CreateImmutableDictionaryInfo<TCollection, TKey, TValue>(JsonSerializerOptions options, JsonCollectionInfoValues<TCollection> collectionInfo, Func<IEnumerable<KeyValuePair<TKey, TValue>>, TCollection> createRangeFunc) where TCollection : IReadOnlyDictionary<TKey, TValue>

Creates serialization metadata for ImmutableDictionary<TKey, TValue> and types assignable to IImmutableDictionary<TKey, TValue>.

public static JsonTypeInfo<TCollection> CreateImmutableEnumerableInfo<TCollection, TElement>(JsonSerializerOptions options, JsonCollectionInfoValues<TCollection> collectionInfo, Func<IEnumerable<TElement>, TCollection> createRangeFunc) where TCollection : IEnumerable<TElement>

Creates serialization metadata for non-dictionary immutable collection types.

public static JsonTypeInfo<TCollection> CreateIReadOnlyDictionaryInfo<TCollection, TKey, TValue>(JsonSerializerOptions options, JsonCollectionInfoValues<TCollection> collectionInfo) where TCollection : IReadOnlyDictionary<TKey, TValue>

Creates serialization metadata for types assignable to IReadOnlyDictionary<T, U>.

public static JsonTypeInfo<TCollection> CreateISetInfo<TCollection, TElement>(JsonSerializerOptions options, JsonCollectionInfoValues<TCollection> collectionInfo) where TCollection : ISet<TElement>

Creates serialization metadata for types assignable to ISet<T>.

public static JsonTypeInfo<TCollection> CreateListInfo<TCollection, TElement>(JsonSerializerOptions options, JsonCollectionInfoValues<TCollection> collectionInfo) where TCollection : List<TElement>

Creates serialization metadata for types assignable to List<T>.

public static JsonTypeInfo<T> CreateObjectInfo<T>(JsonSerializerOptions options, JsonObjectInfoValues<T> objectInfo)

Creates metadata for a complex class or struct.

Creates metadata for a property or field.

public static JsonTypeInfo<TCollection> CreateQueueInfo<TCollection, TElement>(JsonSerializerOptions options, JsonCollectionInfoValues<TCollection> collectionInfo) where TCollection : Queue<TElement>

Creates serialization metadata for types assignable to Queue<T>.

public static JsonTypeInfo<TCollection> CreateQueueInfo<TCollection>(JsonSerializerOptions options, JsonCollectionInfoValues<TCollection> collectionInfo, Action<TCollection, object> addFunc) where TCollection : IEnumerable

Creates serialization metadata for Queue types.

public static JsonTypeInfo<TCollection> CreateStackInfo<TCollection, TElement>(JsonSerializerOptions options, JsonCollectionInfoValues<TCollection> collectionInfo) where TCollection : Stack<TElement>

Creates serialization metadata for types assignable to Stack<T>.

public static JsonTypeInfo<TCollection> CreateStackInfo<TCollection>(JsonSerializerOptions options, JsonCollectionInfoValues<TCollection> collectionInfo, Action<TCollection, object> addFunc) where TCollection : IEnumerable

Creates serialization metadata for Stack types.

public static JsonTypeInfo<T> CreateValueInfo<T>(JsonSerializerOptions options, JsonConverter converter)

Creates metadata for a primitive or a type with a custom converter.

public static JsonConverter<T> GetEnumConverter<T>(JsonSerializerOptions options) where T : struct, Enum

Creates a JsonConverter<T> instance that converts T values.

public static JsonConverter<T?> GetNullableConverter<T>(JsonTypeInfo<T> underlyingTypeInfo) where T : struct

Creates a JsonConverter<T> instance that converts T?? values.

public static JsonConverter<T?> GetNullableConverter<T>(JsonSerializerOptions options) where T : struct

Creates a JsonConverter<T> instance that converts T?? values.

Creates a JsonConverter<T> instance that throws NotSupportedException.