JsonSerializerOptions class
Configuration options for the JSON serializer.
This class provides configuration for custom types, converters, and naming conventions used during serialization and deserialization operations.
Constructors
-
JsonSerializerOptions({List<
GenericType> types = const [], List<JsonConverter> converters = const [], List<NamingConvention> ? namingConventions, NamingConvention? jsonNamingConvention}) - Creates a new instance of JsonSerializerOptions.
Properties
-
converters
→ List<
JsonConverter> -
The list of registered converters for type conversion.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- jsonNamingConvention → NamingConvention?
-
The naming convention to use for JSON property names.
final
-
namingConventions
→ List<
NamingConvention> -
The list of supported naming conventions for property name conversion.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
types
→ List<
GenericType> -
The list of user-defined types registered with the serializer.
final
Methods
-
convertFromJson(
String jsonPropertyName, Map json) → String - Converts a property name from JSON naming convention to camelCase.
-
convertToJson(
String camelCasePropertyName) → String - Converts a property name from camelCase to the configured JSON naming convention.
-
detectNamingConvention(
Map json) → NamingConvention? - Detects the naming convention used in a JSON object by analyzing property names.
-
getConverter(
TypeInfo type) → JsonConverter - Retrieves the appropriate converter for the given type.
-
getGenericType(
TypeInfo type) → GenericType - Retrieves the appropriate generic type for the given type information.
-
merge(
JsonSerializerOptions? options) → JsonSerializerOptions - Merges the current options with the provided options, creating a new instance.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited