Skip to content

Default Json options: NumberHandling #2022

Closed

Description

@jods4

Most users would expect the default JSON serialization to match ASP.NET default serialization.

I suggest that GetDefaultJsonSerializerOptions() here: https://github.com/reactiveui/refit/blob/main/Refit/SystemTextJsonContentSerializer.cs#L64-L78 should be based on JsonSerializerOptions.Web in .NET 9+, or equivalent options in lower runtimes.

The key difference (besides the converters added by Refit) is NumberHandling.
Default web serializer sets NumberHandling = JsonNumberHandling.AllowReadingFromString.

The consequence of this change is that deserialization into numbers would be possible from strings, which should not be a breaking change.
It's not uncommon to serialize numbers into strings when using numbers larger than doubles, or decimal types.

Activity

  1. added
    🟢 priority: low
    🔤 area: serialization
    on Jun 16, 2026
  2. github-actions commented on Jul 8, 2026

    @github-actions

    This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  3. locked as resolved and limited conversation to collaborators on Jul 8, 2026
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

    ✨ enhancement🔤 area: serialization🟢 priority: low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions