fsprojects / FSharp.Json

F# JSON Reflection based serialization library
Apache License 2.0
226 stars 26 forks source link

Round tripping an union type with a single string field throws an exception #38

Open mrakgr opened 4 years ago

mrakgr commented 4 years ago
open FSharp.Json

type ClientMsgs =
    | ProjectDir of string

Json.serialize (ProjectDir "qwe") |> Json.deserialize |> fun (x : ClientMsgs) -> x |> printfn "%A"

This throwing an exception surprised me. I guess I'll try adding a second field.

Edit: That works around the issue.