I need to read data from a JSON and there are some money data as shown below:
$234,205,860
I thought to map this data to my DTO class as String, but I am not sure if there is a proper data type in Java. I look at on the web, but could not see any for this kind of data.
So, is there any data type for this money value? Or should I use String to keep this kind of data in Java?
Precision is the keyword here. Double* and float are a bad choice in most cases! To not lose precision, String could come to mind and would work for storing values nicely without running into issues ruining precision. Long may be fine as well in some cases.
If you need to manipulate values in the future go for BigDecimal. What data type to use for money in Java?
Edit: *should be double (not long).