r/java
•
u/loicmathieu
•
Jul 23 '26
•
1
JEP 540: Simple JSON API (Incubator)
https://openjdk.org/jeps/540
79
Upvotes
View all comments
Show parent comment
18
u/gnahraf Jul 23 '26
Same. Most financial applications use fixed precision decimals. BigDecimal is their natural representation in java; the other existing java types (double, long, etc) do not model them well. I think the JEP's omitting BD (and BI) would be a mistake. (I'll contribute a comment there.)
In general, I think the handling of numbers in json requires care, especially if the consuming end does not know the documents' data types a priori. I wrestle with such issues already. Take json number value comparison, for eg. It might help if the library offered helper methods for comparing disparate number types: compare individually, or maybe also against a collection (eg test whether value "exists" in a json number list w/o knowing their types a priori).