Skip to content

Releases: Tarmil/FSharp.SystemTextJson

Version 1.4.36

Choose a tag to compare

@github-actions github-actions released this 13 Jun 17:57
  • #203: fix enum-like unions mistakenly using PropertyNamingPolicy when not in property name position.
  • #203: fix enum-like unions not using PropertyNamingCaseInsensitive or UnionTagCaseInsensitive depending on position.
  • #204: fix enum-like unions serialized with an extraneous field name.

Version 1.4

Choose a tag to compare

@github-actions github-actions released this 09 Jun 15:58
  • #177: Support enum-like unions (ie unions where no cases have fields) as key for maps and dictionaries.
  • #180: In WithOverrides, allow using typedefof to override generic types.
  • #181: Add WithOverrideMembers option to add JsonNameAttributes to given record fields or union cases.
  • #192: Update dependency on System.Text.Json to 6.0.10.
  • #195: Fix JsonNameAttribute's PropertyTargets so that it can be applied to cases with arguments when compiling with F# 9.
  • #198: Improve performance of type comparisons.
  • #201: Reduce memory allocations when serializing or deserializing tuples and struct tuples with 2, 3 or 4 items.

Version 1.3

Choose a tag to compare

@github-actions github-actions released this 04 Apr 09:38
  • #151: Add optional argument deserializeNullAsNone: bool to option .WithSkippableOptionFields(SkippableOptionFields). When true, skippable option fields can be deserialized as None not only from a missing field, but also from null.

Patch 1.2.42

Choose a tag to compare

@github-actions github-actions released this 30 Aug 09:53

Fix #172: NullReferenceException when serializing a null record.

Version 1.2

Choose a tag to compare

@github-actions github-actions released this 13 Aug 14:47
  • #154: Add SkippableOptionFields enum to further customize the skipping of fields of type option and voption with WithSkippableOptionFields.

    • SkippableOptionFields.FromJsonSerializerOptions is the default and equivalent to WithSkippableOptionFields(false): fields of type option and voption are skipped if used with JsonIgnoreCondition.WhenWritingNull.
    • SkippableOptionFields.Always is equivalent to WithSkippableOptionFields(true): fields of type option and voption are always skipped.
    • SkippableOptionFields.Never: fields of type option and voption are never skipped.
  • #159: Throw an exception when trying to deserialize null into a record or union in any context, rather than only when they are in fields of records and unions.

  • #160: Fix WithSkippableOptionFields(false) not working for voption.

  • #161: Allow using single-case unions as keys in all dictionary types.
    NOTE: This requires System.Text.Json 8.0.

  • #162: Add option .WithMapFormat(MapFormat) to customize the format of F# maps.

    • MapFormat.Object always serializes maps as objects. The key type must be supported as key for dictionaries.
      NOTE: This requires System.Text.Json 8.0.
    • MapFormat.ArrayOfPairs always serializes maps as JSON arrays whose items are [key,value] pairs.
    • MapFormat.ObjectOrArrayOfPairs is the default: maps whose keys are string or single-case unions wrapping string are serialized as JSON objects, and other maps are serialized as JSON arrays whose items are [key,value] pairs.
  • #163: Add StructuralComparison to the type Skippable<_>.

  • #164: When deserializing a record with JsonIgnoreCondition.WhenWritingNull, when a non-nullable field is missing, throw a proper JsonException rather than a NullReferenceException.

Version 1.1

Choose a tag to compare

@github-actions github-actions released this 21 Jan 12:29
d9f2bed
  • #141: Add fluent options builder. JsonFSharpOptions has the following new methods:

    • static methods that create options with default settings: .Default(), .NewtonsoftLike(), .FSharpLuLike() and .ThothLike().
    • instance methods .WithOptionAbc(?bool) for each flag JsonUnionEncoding.Abc, that sets or unsets this option and returns a new JsonFSharpOptions.
    • instance methods .WithAbc(value) for each optional argument abc of its constructor, that sets this option and returns a new JsonFSharpOptions.
    • an instance method .ToJsonSerializerOptions() that returns a new JsonSerializerOptions with the corresponding JsonFSharpConverter configured.
    • an instance method .AddToJsonSerializerOptions(options) that takes an existing JsonSerializerOptions, configures the corresponding JsonFSharpConverter and returns unit.

    The above is now the recommended way of configuring the library, and future options may be only made available using fluent methods and not using constructor arguments.

  • #146: Add option .WithSkippableOptionFields(?bool) that makes fields of type option and voption behave like Skippable: None / ValueNone is represented by a missing field instead of a null value.

    This is equivalent to the pre-1.0 default behavior, and is now recommended if this behavior is desired instead of IgnoreNullValues = true or DefaultIgnoreCondition = WhenWritingNull.

Version 1.0.7

Choose a tag to compare

@github-actions github-actions released this 30 Nov 09:47
  • Fix regression #137: exception on serialization and deserialization of empty anonymous records.

Version 1.0.6

Choose a tag to compare

@github-actions github-actions released this 07 Oct 19:00

Fix regression #133: failure on non-public records.

Version 1.0

Choose a tag to compare

@github-actions github-actions released this 26 Sep 18:18
  • #89: Add JsonNameAttribute as a more powerful substitute for the standard JsonPropertyNameAttribute.

    • When used on a discriminated union case, JsonNameAttribute can take a value of type int or bool instead of string.
    • JsonNameAttribute can take multiple values. When deserializing, all these values are treated as equivalent. When serializing, the first one is used.
    • JsonNameAttribute has a settable property Field: string. It is used to set the JSON name of a union case field with the given name.
  • #92: Serialization of record properties (in addition to fields).

    • Add option includeRecordProperties: bool to enable serializing record properties.
    • Also serialize record properties with JsonIncludeAttribute even when includeRecordProperties is false.
  • Add support for the standard DefaultIgnoreCondition.WhenWritingNull as a synonym for IgnoreNullValues = true that allows None and ValueNone to be omitted instead of null.

  • #123: BREAKING CHANGE: Missing fields of type option or voption now throw an error by default instead of being deserialized to None / ValueNone. To support missing fields, either enable the option IgnoreNullValues = true or DefaultIgnoreCondition = WhenWritingNull, or use the type Skippable instead of option or voption.

  • #126: Add option types: JsonFSharpTypes that specifies which types the F# converter should handle. Unlisted types will be handled by the default System.Text.Json. By default, all supported types are handled.

Version 0.19

Choose a tag to compare

@github-actions github-actions released this 18 Jun 16:59
  • #111: Support JsonKnownNamingPolicy in JsonFSharpConverterAttribute.

  • #112: Add Options and Overrides properties to JsonFSharpConverter.

  • #263: Add a nullary constructor for JsonFSharpConverter.