Releases: Tarmil/FSharp.SystemTextJson
Releases · Tarmil/FSharp.SystemTextJson
Version 0.16
- #83: Fix null reference exception when deserializing a record that
Skip
s a field with FSharp.Core 5.0. - Remove netcoreapp3.0 specific build.
Version 0.15
- #77: Fix compile-time error when publishing a trimmed .NET 5 application. Thanks @pchalamet!
Version 0.14
- #71: Allow overriding specific types in
JsonFSharpConverter
with new argumentoverrides
. These override even types that haveJsonFSharpConverterAttribute
whenallowOverride = true
.
Version 0.13
- #69: Allow overriding
JsonFSharpConverter
options withJsonFSharpConverterAttribute
by passingallowOverride = true
toJsonFSharpConverter
. - Add
JsonUnionEncoding.Inherit
. When this flag is set on aJsonFSharpConverterAttribute
that overrides aJsonFSharpConverter
, this type still uses theJsonFSharpConverter
'sJsonUnionEncoding
.
Version 0.12
- #56: Add
JsonUnionEncoding.UnwrapRecordCases
, which impliesJsonUnionEncoding.NamedFields
and encodes union cases containing a single record field as if the record's fields were the union's fields instead. For example:This option is compatible with all union formats (type U = | U of r: {| x: int; y: bool |} U {| x = 1; y = true |} // Serialized as: {"Case":"U","Fields":{"x":1,"y":true}} // Instead of: {"Case":"U","Fields":{"r":{"x":1,"y":true}}}
AdjacentTag
,ExternalTag
,InternalTag
andUntagged
). - #64: Fix serialization of
unit
as field of an F# type. Thanks @NickDarvey!
Version 0.11
Version 0.10
- #47: Add
Skippable<'T>
to represent values that can be omitted from the serialization of a record or a union withNamedFields
. This is particularly useful withSkippable<'T option>
(orvoption
) to represent a field that can be omitted, null, or have a proper value.Also add atype R = { x: Skippable<int option> } { x = Skip } // Serialized as: {} { x = Include None } // Serialized as: {"x":null} { x = Include (Some 42) } // Serialized as: {"x":42}
Skippable
module with standard functions:map
,filter
, etc. Implementation largely based on @cmeeren's JsonSkippable which provides the same functionality for Newtonsoft.Json. - #51: When the type
K
is a single-case union wrapping a string, serializeMap<K, V>
into a JSON object, likeMap<string, V>
. - Allow OR-ing a base
JsonUnionEncoding
(AdjacentTag
,InternalTag
,ExternalTag
orUntagged
) withDefault
to use the default extra options (UnwrapOption ||| UnwrapSingleCaseUnions
).
Version 0.9
- #43: In deserialization, allow omitting fields that are optional.
- In deserialization, when a field is missing, find which one it is and name it in the error message.
Version 0.8
-
#30: Unwrap
'T voption
withJsonUnionEncoding.UnwrapOption
. Thanks @johlrich! -
#32: Add
JsonUnionEncoding.UnwrapSingleFieldCases
, which encodes the field of single-field cases asx
instead of[x]
. Include it inJsonUnionEncoding.FSharpLuLike
. -
#33: Fix "read too much or not enough" when parsing a list of unions with
JsonUnionEncoding.UnwrapFieldlessTags
. -
#36: BREAKING CHANGE: During deserialization, throw an exception when a field of a record or union has value
null
, unless the type of this field isoption
,voption
, or a union withUseNullAsTrueValue
. Thanks @drhumlen!New option
allowNullFields
disables this behavior. -
#38: Add more consistent names for options:
BareFieldlessTags
becomesUnwrapFieldlessTags
;SuccintOption
becomesUnwrapOption
;EraseSingleCaseUnions
becomesUnwrapSingleCaseUnions
.
The previous names are marked
Obsolete
.
Version 0.7
- #3: Add support for
PropertyNamingPolicy
on record and union fields. - #22: Add support for
DictionaryKeyPolicy
forMap<string, 'T>
. - #27: Add
unionTagNamingPolicy
option toJsonFSharpConverter
andJsonFSharpConverterAttribute
to customize the naming policy for union tag names. - #26: Add
JsonUnionEncoding.EraseSingleCaseUnions
, which encodes single-case single-field unions the same as the value in the field.
BREAKING CHANGE: This is now the default option. - #5: Add support for
PropertyNameCaseInsensitive
on record and union fields.
AddunionTagCaseInsensitive
option toJsonFSharpConverter
andJsonFSharpConverterAttribute
to customize the case sensitivity for union tag names.