Skip to content

custommized format of double number's string value #117

@beclever

Description

@beclever

I have a requirement that If the float(double) value has an exponent, the "e" MUST be in lower
case. in our case,when serializing a JsonObject as a String, For example,

JsonObject jsonObj = new JsonObject();
double value=21474836471d;
jsonObj. Add (" key",value);

Because of the internal call to Json.value(value), then Double.toString(value), this becomes 2.1474836471E10

Since Json is a final class, there are no extensible way to override methods. If we provide an extension, such as my extension class Enhancejson.value method, which I can implement with Double.toString(value).toLowerCase().

My question is, if we can change Json to a non-final class, or is there a better way to solve this problem?

if no workaround, I'll consider to make a Pull Request. Thank you very much.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions