This code throws System.ArgumentException: 'Could not determine JSON object type for type Program+MyRecord.'
type MyRecord = {
Field1 : string
Field2 : int
Field3 : bool
}
type Wrapper<'a> = {
Id: string
Config: 'a
}
let myObject = {
Id = "test test test";
Config = (box {Field1 = "hi"; Field2 = 2; Field3 = true })
}
let result = JsonConvert.SerializeObject(myObject, Converters.Converter())
If we remove the box, the serialization works but sadly in my case I cannot avoid it.