Fix #172: NullReferenceException when serializing a null record.
Version 1.2
#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
#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
Fix regression #137: exception on serialization and deserialization of empty anonymous records.
Version 1.0.6
Fix regression #133: failure on non-public records.
#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.
1.1
#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.
1.0
#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.
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Bumps FSharp.SystemTextJson from 0.17.4 to 1.2.42.
Release notes
Sourced from FSharp.SystemTextJson's releases.
... (truncated)
Changelog
Sourced from FSharp.SystemTextJson's changelog.
... (truncated)
Commits
53f4302
Add test for union in regression #17203f0b9b
Merge pull request #174 from Tarmil/fix-nre29f4847
Use Writer.WriteNullValue instead of JsonSerializer.Serializebb444c5
Fix NullReferenceException when serializing null record-typed record field0f20ae7
Simplify test74d3924
Remove comment057386a
Strengthen testa3d4c4f
Add failing testcfa75d3
Set version to '1.2'250eed9
Update changelogDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show