Skip to content

Parsing scientific notation to decimal #633

@kslesinsky

Description

@kslesinsky

I came across an issue using JsonDeserializer when the data I needed to parse had the value "4.8e-04" for a decimal property. Currently a FormatException is thrown. As the below SO post indicates, NumberStyles.Float needs to be passed as the second parameter to Decimal.Parse().

http://stackoverflow.com/questions/3879463/parse-a-number-from-exponential-notation

Maybe in ConvertValue(), under "if (type == typeof(Decimal)" it could check if stringValue contains "e" ... and if so, return Decimal.Parse(stringValue, NumberStyles.Float);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions