-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Labels
enhancementNew feature or requestNew feature or request
Description
When using WithUnwrapOption(false), None still serializes to null.
(I am serializing for logging/assertion/debugging purposes and want None/ValueNone to serialize to the strings "None"/"ValueNone", as I expect is the intended functionality with WithUnwrapOption(false).)
open System.Text.Json
open System.Text.Json.Serialization
open Xunit
let options = JsonSerializerOptions()
options.Converters.Add(
JsonFSharpOptions
.Default()
.WithUnwrapOption(false)
|> JsonFSharpConverter
)
Assert.Equal("\"None\"", JsonSerializer.Serialize(None))This fails with:
Xunit.Sdk.EqualException
Assert.Equal() Failure
↓ (pos 0)
Expected: "None"
Actual: null
↑ (pos 0)
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request