Skip to content

Switch to storing enums as ints in JSON instead of strings #31100

@roji

Description

@roji

We currently serialize .NET enums into JSON as their string label; this is:

  1. Incompatible with the behavior of System.Text.Json and Newtonsoft.Json, which serialize to the underlying int value.
  2. Incompatible with our relational behavior, which also value-converts to the int value. This notably means that it's impossible to compare an enum value inside JSON with another enum value outside of JSON in a LINQ query.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions