-
Notifications
You must be signed in to change notification settings - Fork 234
Closed
Description
Describe the bug
current implementation of JsonTransformer -> value2String() only allows Double values if fractional part is 0, by the following condition.
(value instanceof Double && BigDecimal.valueOf((Double) value).remainder(BigDecimal.ONE).doubleValue() == 0)
whereas I would expect the double values like 32.59 should be able to treated as number instead of string.
To Reproduce
- use schema with field of data type Double
- generate the filed value of type Double
you will find the data generated is:
{
"price": "32.59"
}
Expected behavior
{
"price": 32.59
}
Versions:
- OS: mac os 15.x
- JDK - 11
- Faker Version [e.g. 22] - 1.9.0 - 2.4.3
Additional context
This may not be bug, but I am not able to make sense of treating Double value with additional logic and enforcement of requiring fractional to 0. Happy to convert it into feature request.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working