Skip to content
This repository was archived by the owner on Mar 25, 2026. It is now read-only.
This repository was archived by the owner on Mar 25, 2026. It is now read-only.

Swan.Formatters.Json class sometimes serialize double as string #303

@mayorovad

Description

@mayorovad

Describe the bug
Serializing double value to JSON using Swan.Formatters.Json class sometimes results in string in exponential form.

To Reproduce

using Swan.Formatters;
using System.Text.Json;

List<double> doubleValues = [1, 5e-5];

var swanRes = Json.Serialize(doubleValues);
var textJsonRes = JsonSerializer.Serialize(doubleValues);

Console.WriteLine($"SWAN: {swanRes}");
Console.WriteLine($"Text.Json: {textJsonRes}");

results in

SWAN: [1,"5E-05"]
Text.Json: [1,5E-05]

Expected behavior

SWAN: [1,5E-05]
Text.Json: [1,5E-05]

Additional Info
Using package Unosquare.Swan.Lite, version 3.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions