Reputation: 5503
such a simple question,
Can a BigDecimal
field used as a parameter for a REST API in my WebObject?
As BigDecimal
should be instantiated using constructor, will that happen if I send the parameter
{
"input" : 5
}
Will this parameter instantiated to BigDecimal automatically?
Upvotes: 5
Views: 5001
Reputation: 10142
It all depends as what API framework you using. With Spring Boot which uses Jackson API to deserialize, this will be converted correctly.
Directly using BigDecimal
in front transfer object might not give you correct scaling & precision so I recommend to take String
input and customize your BigDecimal
creation as per need.
Upvotes: 2