Сan FSharp.SystemTextJson work with case like this when I have only 1 letter or not full word and I want to return
Example:
in json I have "Mail" or "m"
and I want to return Comunication.Mailing
open System
open System.Text.Json
open System.Text.Json.Serialization
[<JsonFSharpConverter(JsonUnionEncoding.FSharpLuLike)>]
type Comunication =
| [<JsonName"MAILING">] Mailing
| [<JsonName "STANDART>] Standart
type Robot = {
Code : int
Model : Comunication
}
[<EntryPoint>]
let main args =
let r2d2 = { Code = 123; Model = AddressType.Mailing }
let x = JsonSerializer.Deserialize<Robot>( """{"Code":123,"Model":"M"}"""
0
Сan FSharp.SystemTextJson work with case like this when I have only 1 letter or not full word and I want to return
Example: in json I have "Mail" or "m" and I want to return Comunication.Mailing
[]
let ( """{"Code":123,"Model":"M"}""", options))
**should return Mailing**
() = Assert.Equal(r2d2, JsonSerializer.Deserialize