Skip to content

Enum Serialization with unwrapped field less tags creates invalid json #204

Closed

Description

@marcpiechura

After upgrading to Version 1.4.34 I can no longer serialize simple enums, it works with the previous version 1.3.13
This code:

type Enum =
    | Case1
    | Case2
    
type Record =
    { Field: Enum }


let options = 
    JsonFSharpOptions
        .Default()
        .WithUnionUnwrapFieldlessTags()
        .ToJsonSerializerOptions()

let json = JsonSerializer.Serialize({ Field = Enum.Case2 }, options)

Creates the following json

{"Field":"Case":"Case2"}

Activity

  1. Tarmil commented on Jun 13, 2025

    @Tarmil
    Owner

    Sorry, buggy release indeed, fixing this asap.

  2. added a commit that references this issue on Jun 13, 2025
  3. Tarmil commented on Jun 13, 2025

    @Tarmil
    Owner

    This is fixed in v1.4.36.

  4. marcpiechura commented on Jun 13, 2025

    @marcpiechura
    ContributorAuthor

    Thank you very much for the quick fix!

  5. aspnetde commented on Jul 2, 2025

    @aspnetde

    I ran into this as well. Thank you for fixing and all the work you are doing. Much appreciated!

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

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions