Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​Text.​Json.​Serialization.​Metadata.​JsonMetadataServices
Assembly: System.Text.Json
Inheritance: object → JsonMetadataServices
Provides helpers to create and initialize metadata for JSON-serializable types.
Properties
public static
JsonConverter<​bool>
BooleanConverter
Gets an object that converts <see cref="T:System.Boolean" /> values.
public static
JsonConverter<​byte[]>
ByteArrayConverter
Gets an object that converts byte array values.
public static
JsonConverter<​byte>
ByteConverter
Gets an object that converts <see cref="T:System.Byte" /> values.
public static
JsonConverter<​char>
CharConverter
Gets an object that converts <see cref="T:System.Char" /> values.
public static
JsonConverter<​DateTime>
DateTimeConverter
Gets an object that converts <see cref="T:System.DateTime" /> values.
public static
JsonConverter<​DateTimeOffset>
DateTimeOffsetConverter
Gets an object that converts <see cref="T:System.DateTimeOffset" /> values.
public static
JsonConverter<​decimal>
DecimalConverter
Gets an object that converts <see cref="T:System.Decimal" /> values.
public static
JsonConverter<​double>
DoubleConverter
Gets an object that converts <see cref="T:System.Double" /> values.
public static
JsonConverter<​Guid>
GuidConverter
Gets an object that converts <see cref="T:System.Guid" /> values.
public static
JsonConverter<​short>
Int16Converter
Gets an object that converts <see cref="T:System.Int16" /> values.
public static
JsonConverter<​int>
Int32Converter
Gets an object that converts <see cref="T:System.Int32" /> values.
public static
JsonConverter<​long>
Int64Converter
Gets an object that converts <see cref="T:System.Int64" /> values.
public static
JsonConverter<​Nodes.​JsonArray>
JsonArrayConverter
Gets an object that converts <see cref="T:System.Json.JsonArray" /> values.
public static
JsonConverter<​JsonDocument>
JsonDocumentConverter
Returns a <see cref="T:System.Text.Json.Serialization.JsonConverter`1" /> instance that converts <see cref="T:System.Text.Json.JsonDocument" /> values.
public static
JsonConverter<​JsonElement>
JsonElementConverter
Gets a JSON converter that converts <see cref="T:System.Text.Json.JsonElement" /> values.
public static
JsonConverter<​Nodes.​JsonNode>
JsonNodeConverter
Gets an object that converts <see cref="T:System.Text.Json.Nodes.JsonNode" /> values.
public static
JsonConverter<​Nodes.​JsonObject>
JsonObjectConverter
Gets an object that converts <see cref="T:System.Json.JsonObject" /> values.
public static
JsonConverter<​Nodes.​JsonValue>
JsonValueConverter
Gets an object that converts <see cref="T:System.Json.JsonValue" /> values.
public static
JsonConverter<​Memory<​byte>>
MemoryByteConverter
Returns a <see cref="T:System.Text.Json.Serialization.JsonConverter`1" /> instance that converts <see cref="T:System.Memory`1" /> values.
public static
JsonConverter<​object>
ObjectConverter
Gets an object that converts <see cref="T:System.Object" /> values.
public static
JsonConverter<​ReadOnlyMemory<​byte>>
ReadOnlyMemoryByteConverter
Returns a <see cref="T:System.Text.Json.Serialization.JsonConverter`1" /> instance that converts <see cref="T:System.ReadOnlyMemory`1" /> values.
public static
JsonConverter<​sbyte>
SByteConverter
Gets an object that converts <see cref="T:System.SByte" /> values.
public static
JsonConverter<​Single>
SingleConverter
Gets an object that converts <see cref="T:System.Single" /> values.
public static
JsonConverter<​string>
StringConverter
Gets an object that converts <see cref="T:System.String" /> values.
public static
JsonConverter<​TimeSpan>
TimeSpanConverter
Gets a JSON converter that converts <see cref="T:System.TimeSpan" /> values.
public static
JsonConverter<​ushort>
UInt16Converter
Gets an object that converts <see cref="T:System.UInt16" /> values.
public static
JsonConverter<​uint>
UInt32Converter
Gets an object that converts <see cref="T:System.UInt32" /> values.
public static
JsonConverter<​ulong>
UInt64Converter
Gets an object that converts <see cref="T:System.UInt64" /> values.
public static
JsonConverter<​Uri>
UriConverter
Gets an object that converts <see cref="T:System.Uri" /> values.
public static
JsonConverter<​Version>
VersionConverter
Gets an object that converts <see cref="T:System.Version" /> values.
public static
JsonConverter<​DateOnly>
DateOnlyConverter
Returns a <see cref="T:System.Text.Json.Serialization.JsonConverter`1" /> instance that converts <see cref="T:System.DateOnly" /> values.
public static
JsonConverter<​Half>
HalfConverter
Returns a <see cref="T:System.Text.Json.Serialization.JsonConverter`1" /> instance that converts <see cref="T:System.Half" /> values.
public static
JsonConverter<​TimeOnly>
TimeOnlyConverter
Returns a <see cref="T:System.Text.Json.Serialization.JsonConverter`1" /> instance that converts <see cref="T:System.TimeOnly" /> values.
public static
JsonConverter<​Int128>
Int128Converter
Returns a <see cref="T:System.Text.Json.Serialization.JsonConverter`1" /> instance that converts <see cref="T:System.Int128" /> values.
public static
JsonConverter<​UInt128>
UInt128Converter
Returns a <see cref="T:System.Text.Json.Serialization.JsonConverter`1" /> instance that converts <see cref="T:System.UInt128" /> values.
Methods
public static
JsonTypeInfo<​TElement[]>
CreateArrayInfo​(JsonSerializerOptions options,
JsonCollectionInfoValues<​TElement[]> collectionInfo)
Creates serialization metadata for an array.
Returns Serialization metadata for the given type.
options
The serialization and deserialization options to use.
collectionInfo
Provides serialization metadata about the collection type.
public static
JsonTypeInfo<​TCollection>
CreateConcurrentQueueInfo​(JsonSerializerOptions options,
JsonCollectionInfoValues<​TCollection> collectionInfo)
Creates metadata for types assignable to <see cref="T:System.Collections.Concurrent.ConcurrentQueue`1" /> .
Returns Serialization metadata for the given type.
options
The serialization and deserialization options to use.
collectionInfo
Provides serialization metadata about the collection type.
public static
JsonTypeInfo<​TCollection>
CreateConcurrentStackInfo​(JsonSerializerOptions options,
JsonCollectionInfoValues<​TCollection> collectionInfo)
Creates metadata for types assignable to <see cref="T:System.Collections.Concurrent.ConcurrentStack`1" /> .
Returns Serialization metadata for the given type.
options
The <see cref="T:System.Text.Json.JsonSerializerOptions" /> to use for serialization and deserialization.
collectionInfo
Provides serialization metadata about the collection type.
public static
JsonTypeInfo<​TCollection>
CreateDictionaryInfo​(JsonSerializerOptions options,
JsonCollectionInfoValues<​TCollection> collectionInfo)
Creates metadata for types assignable to <see cref="T:System.Collections.Generic.Dictionary`2" /> .
Returns Serialization metadata for the given type.
options
The <see cref="T:System.Text.Json.JsonSerializerOptions" /> to use for serialization and deserialization.
collectionInfo
Provides serialization metadata about the collection type.
public static
JsonTypeInfo<​TCollection>
CreateIAsyncEnumerableInfo​(JsonSerializerOptions options,
JsonCollectionInfoValues<​TCollection> collectionInfo)
Creates serialization metadata for types assignable to <see cref="T:System.Collections.Generic.IAsyncEnumerable`1" /> .
Returns Serialization metadata for the given type.
options
The <see cref="T:System.Text.Json.JsonSerializerOptions" /> to use for serialization and deserialization.
collectionInfo
Provides serialization metadata about the collection type.
public static
JsonTypeInfo<​TCollection>
CreateICollectionInfo​(JsonSerializerOptions options,
JsonCollectionInfoValues<​TCollection> collectionInfo)
Creates metadata for types assignable to <see cref="T:System.Collections.Generic.ICollection`1" /> .
Returns Serialization metadata for the given type.
options
The <see cref="T:System.Text.Json.JsonSerializerOptions" /> to use for serialization and deserialization.
collectionInfo
Provides serialization metadata about the collection type.
public static
JsonTypeInfo<​TCollection>
CreateIDictionaryInfo​(JsonSerializerOptions options,
JsonCollectionInfoValues<​TCollection> collectionInfo)
Creates metadata for types assignable to <see cref="T:System.Collections.IDictionary" /> .
Returns Serialization metadata for the given type.
options
The <see cref="T:System.Text.Json.JsonSerializerOptions" /> to use for serialization and deserialization.
collectionInfo
Provides serialization metadata about the collection type.
public static
JsonTypeInfo<​TCollection>
CreateIDictionaryInfo​(JsonSerializerOptions options,
JsonCollectionInfoValues<​TCollection> collectionInfo)
Creates metadata for types assignable to <see cref="T:System.Collections.Generic.IDictionary`2" /> .
Returns Serialization metadata for the given type.
options
The <see cref="T:System.Text.Json.JsonSerializerOptions" /> to use for serialization and deserialization.
collectionInfo
Provides serialization metadata about the collection type.
public static
JsonTypeInfo<​TCollection>
CreateIEnumerableInfo​(JsonSerializerOptions options,
JsonCollectionInfoValues<​TCollection> collectionInfo)
Creates metadata for types assignable to <see cref="T:System.Collections.IEnumerable" /> .
Returns Serialization metadata for the given type.
options
The <see cref="T:System.Text.Json.JsonSerializerOptions" /> to use for serialization and deserialization.
collectionInfo
Provides serialization metadata about the collection type.
public static
JsonTypeInfo<​TCollection>
CreateIEnumerableInfo​(JsonSerializerOptions options,
JsonCollectionInfoValues<​TCollection> collectionInfo)
Creates metadata for types assignable to <see cref="T:System.Collections.Generic.IEnumerable`1" /> .
Returns Serialization metadata for the given type.
options
The <see cref="T:System.Text.Json.JsonSerializerOptions" /> to use for serialization and deserialization.
collectionInfo
Provides serialization metadata about the collection type.
public static
JsonTypeInfo<​TCollection>
CreateIListInfo​(JsonSerializerOptions options,
JsonCollectionInfoValues<​TCollection> collectionInfo)
Creates metadata for types assignable to <see cref="T:System.Collections.IList" /> .
Returns Serialization metadata for the given type.
options
The <see cref="T:System.Text.Json.JsonSerializerOptions" /> to use for serialization and deserialization.
collectionInfo
Provides serialization metadata about the collection type.
public static
JsonTypeInfo<​TCollection>
CreateIListInfo​(JsonSerializerOptions options,
JsonCollectionInfoValues<​TCollection> collectionInfo)
Creates metadata for types assignable to <see cref="T:System.Collections.Generic.IList`1" /> .
Returns Serialization metadata for the given type.
options
The <see cref="T:System.Text.Json.JsonSerializerOptions" /> to use for serialization and deserialization.
collectionInfo
Provides serialization metadata about the collection type.
public static
JsonTypeInfo<​TCollection>
CreateImmutableDictionaryInfo​(JsonSerializerOptions options,
JsonCollectionInfoValues<​TCollection> collectionInfo,
Func<​Collections.​Generic.​IEnumerable<​Collections.​Generic.​KeyValuePair<​TKey, TValue>>, TCollection> createRangeFunc)
Creates metadata for <see cref="T:System.Collections.Immutable.ImmutableDictionary`2" /> and types assignable to <see cref="T:System.Collections.Generic.IReadOnlyDictionary`2" /> .
Returns Serialization metadata for the given type.
options
The <see cref="T:System.Text.Json.JsonSerializerOptions" /> to use for serialization and deserialization.
collectionInfo
Provides serialization metadata about the collection type.
createRangeFunc
A method to create an immutable dictionary instance.
public static
JsonTypeInfo<​TCollection>
CreateImmutableEnumerableInfo​(JsonSerializerOptions options,
JsonCollectionInfoValues<​TCollection> collectionInfo,
Func<​Collections.​Generic.​IEnumerable<​TElement>, TCollection> createRangeFunc)
Creates metadata for non-dictionary immutable collection types.
Returns Serialization metadata for the given type.
options
The <see cref="T:System.Text.Json.JsonSerializerOptions" /> to use for serialization and deserialization.
collectionInfo
Provides serialization metadata about the collection type.
createRangeFunc
A method to create an immutable dictionary instance.
public static
JsonTypeInfo<​TCollection>
CreateIReadOnlyDictionaryInfo​(JsonSerializerOptions options,
JsonCollectionInfoValues<​TCollection> collectionInfo)
Creates metadata for types assignable to <see cref="T:System.Collections.Generic.IReadOnlyDictionary`2" /> .
Returns Serialization metadata for the given type.
options
The <see cref="T:System.Text.Json.JsonSerializerOptions" /> to use for serialization and deserialization.
collectionInfo
Provides serialization metadata about the collection type.
public static
JsonTypeInfo<​TCollection>
CreateISetInfo​(JsonSerializerOptions options,
JsonCollectionInfoValues<​TCollection> collectionInfo)
Creates metadata for types assignable to <see cref="T:System.Collections.Generic.ISet`1" /> .
Returns Serialization metadata for the given type.
options
The <see cref="T:System.Text.Json.JsonSerializerOptions" /> to use for serialization and deserialization.
collectionInfo
Provides serialization metadata about the collection type.
public static
JsonTypeInfo<​TCollection>
CreateListInfo​(JsonSerializerOptions options,
JsonCollectionInfoValues<​TCollection> collectionInfo)
Creates metadata for types assignable to <see cref="T:System.Collections.Generic.List`1" /> .
Returns Serialization metadata for the given type.
options
The <see cref="T:System.Text.Json.JsonSerializerOptions" /> to use for serialization and deserialization.
collectionInfo
Provides serialization metadata about the collection type.
public static
JsonTypeInfo<​Memory<​TElement>>
CreateMemoryInfo​(JsonSerializerOptions options,
JsonCollectionInfoValues<​Memory<​TElement>> collectionInfo)
Creates serialization metadata for <see cref="T:System.Memory`1" /> .
Returns Serialization metadata for the given type.
options
The <see cref="T:System.Text.Json.JsonSerializerOptions" /> to use.
collectionInfo
Provides serialization metadata about the collection type.
public static
JsonTypeInfo<​T>
CreateObjectInfo​(JsonSerializerOptions options,
JsonObjectInfoValues<​T> objectInfo)
Creates metadata for a complex class or struct.
Returns A <see cref="T:System.Text.Json.Serialization.Metadata.JsonTypeInfo`1" /> instance representing the class or struct.
options
The <see cref="T:System.Text.Json.JsonSerializerOptions" /> to use for serialization and deserialization.
objectInfo
Provides serialization metadata about an object type with constructors, properties, and fields.
public static
JsonPropertyInfo
CreatePropertyInfo​(JsonSerializerOptions options,
JsonPropertyInfoValues<​T> propertyInfo)
Creates metadata for a property or field.
Returns A <see cref="T:System.Text.Json.Serialization.Metadata.JsonPropertyInfo" /> instance initialized with the provided metadata.
options
The <see cref="T:System.Text.Json.JsonSerializerOptions" /> to use for serialization and deserialization.
propertyInfo
Provides serialization metadata about the property or field.
public static
JsonTypeInfo<​TCollection>
CreateQueueInfo​(JsonSerializerOptions options,
JsonCollectionInfoValues<​TCollection> collectionInfo,
Action<​TCollection, object> addFunc)
Creates metadata for types assignable to <see cref="T:System.Collections.Queue" /> .
Returns Serialization metadata for the given type.
options
The <see cref="T:System.Text.Json.JsonSerializerOptions" /> to use for serialization and deserialization.
collectionInfo
Provides serialization metadata about the collection type.
addFunc
A method for adding elements to the collection when using the serializer's code-paths.
public static
JsonTypeInfo<​TCollection>
CreateQueueInfo​(JsonSerializerOptions options,
JsonCollectionInfoValues<​TCollection> collectionInfo)
Creates metadata for types assignable to <see cref="T:System.Collections.Generic.Queue`1" /> .
Returns Serialization metadata for the given type.
options
The <see cref="T:System.Text.Json.JsonSerializerOptions" /> to use for serialization and deserialization.
collectionInfo
Provides serialization metadata about the collection type.
public static
JsonTypeInfo<​ReadOnlyMemory<​TElement>>
CreateReadOnlyMemoryInfo​(JsonSerializerOptions options,
JsonCollectionInfoValues<​ReadOnlyMemory<​TElement>> collectionInfo)
Creates serialization metadata for <see cref="T:System.ReadOnlyMemory`1" /> .
Returns Serialization metadata for the given type.
options
The <see cref="T:System.Text.Json.JsonSerializerOptions" /> to use.
collectionInfo
Provides serialization metadata about the collection type.
public static
JsonTypeInfo<​TCollection>
CreateStackInfo​(JsonSerializerOptions options,
JsonCollectionInfoValues<​TCollection> collectionInfo,
Action<​TCollection, object> addFunc)
Creates metadata for types assignable to <see cref="T:System.Collections.Stack" /> .
Returns Serialization metadata for the given type.
options
The <see cref="T:System.Text.Json.JsonSerializerOptions" /> to use for serialization and deserialization.
collectionInfo
Provides serialization metadata about the collection type.
addFunc
A method for adding elements to the collection when using the serializer's code-paths.
public static
JsonTypeInfo<​TCollection>
CreateStackInfo​(JsonSerializerOptions options,
JsonCollectionInfoValues<​TCollection> collectionInfo)
Creates metadata for types assignable to <see cref="T:System.Collections.Generic.Stack`1" /> .
Returns Serialization metadata for the given type.
options
The <see cref="T:System.Text.Json.JsonSerializerOptions" /> to use for serialization and deserialization.
collectionInfo
Provides serialization metadata about the collection type.
public static
JsonTypeInfo<​T>
CreateValueInfo​(JsonSerializerOptions options,
JsonConverter converter)
Creates metadata for a primitive or a type with a custom converter.
Returns A <see cref="T:System.Text.Json.Serialization.Metadata.JsonTypeInfo`1" /> instance representing the type.
options
The <see cref="T:System.Text.Json.JsonSerializerOptions" /> to use for serialization and deserialization.
public static
JsonConverter<​T>
GetEnumConverter​(JsonSerializerOptions options)
Creates a <see cref="T:System.Text.Json.Serialization.JsonConverter`1" /> instance that converts <typeparamref name="T" /> values.
Returns A <see cref="T:System.Text.Json.Serialization.JsonConverter`1" /> instance that converts <typeparamref name="T" /> values.
options
The <see cref="T:System.Text.Json.JsonSerializerOptions" /> to use for serialization and deserialization.
public static
JsonConverter<​T?>
GetNullableConverter​(JsonSerializerOptions options)
Creates a <see cref="T:System.Text.Json.Serialization.JsonConverter`1" /> instance that converts <typeparamref name="T??" /> values.
Returns A <see cref="T:System.Text.Json.Serialization.JsonConverter`1" /> instance that converts <typeparamref name="T??" /> values
options
The <see cref="T:System.Text.Json.JsonSerializerOptions" /> to use for serialization and deserialization.
public static
JsonConverter<​T?>
GetNullableConverter​(JsonTypeInfo<​T> underlyingTypeInfo)
Creates a <see cref="T:System.Text.Json.Serialization.JsonConverter`1" /> instance that converts <typeparamref name="T??" /> values.
Returns A <see cref="T:System.Text.Json.Serialization.JsonConverter`1" /> instance that converts <typeparamref name="T??" /> values
underlyingTypeInfo
Serialization metadata for the underlying nullable type.
public static
JsonConverter<​T>
GetUnsupportedTypeConverter​()
Gets a type converter that throws a <see cref="T:System.NotSupportedException" /> .
Returns A <see cref="T:System.Text.Json.Serialization.JsonConverter`1" /> instance that throws <see cref="T:System.NotSupportedException" />
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object