Skip to content

JsonSerializer should serialize tuples by default #70352

@krwq

Description

@krwq

Currently:

  • tuples don't serialize by default (options.IncludeFields = true is required)
  • they don't preserve names (serialize as {"Item1":"foo","Item2":"bar"}

We should improve this behavior and figure out how to not break people potentially relying on the existing behavior.

Example possibilities for fixing this:

  • we provide converter for serialization
  • we provide options switch (i.e. TupleHandling)

Possible ways of serialization:

  • array
  • object, we need to figure out if it's possible to preserve user provided names

related: #68264

Metadata

Metadata

Assignees

Labels

api-suggestionEarly API idea and discussion, it is NOT ready for implementationarea-System.Text.Jsonin-prThere is an active PR which will close this issue when it is mergedwishlistIssue we would like to prioritize, but we can't commit we will get to it yet

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions