Skip to content

Cannot serialized higher order type when type is boxed #32

Description

@bruno-cadorette

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions