JsonSerializerOptions class

Options for the JSON serializer.

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.
final
hashCode int
The hash code for this object.
no setterinherited
jsonNamingConvention NamingConvention?
The naming convention to use for JSON property names. If null, the convention will be auto-detected from the JSON.
final
namingConventions List<NamingConvention>
The list of supported naming conventions.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
types List<GenericType>
The list of user-defined types.
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 JSON naming convention.
detectNamingConvention(Map json) NamingConvention?
Detects the naming convention used in a JSON object. Returns the first matching convention, or null if no match is found.
getConverter(TypeInfo type) JsonConverter
Retrieves the appropriate JsonConverter for the given type.
getGenericType(TypeInfo type) → GenericType
Retrieves the appropriate GenericType for the given type.
merge(JsonSerializerOptions? options) JsonSerializerOptions
Merges the current JsonSerializerOptions with the provided options. Returns a new JsonSerializerOptions 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