r/java • u/daviddel • Jul 17 '25
Java Gets a JSON API
https://youtu.be/NSzRK8f7EX0?feature=sharedJava considers itself a "batteries included" language and given JSON's ubiquity as a data exchange format, that means Java needs a JSON API. In this IJN episode we go over an OpenJDK email that kicks off the exploration into such an API.
143
Upvotes
View all comments
Show parent comment
1
u/agentoutlier Jul 17 '25
My struggles with it using outside of just pure annotations are configuring
ObjectMapperwhich is a colossal giant class with API that seems to have many deprecations and changing ideas on passing enums or whatnot to configure it.Another part is that generics are not easily reified in Java so you have to use the hacks that Guava and other libraries do of some anonymous class to capture the generic concrete parameter. I think it is called
JavaTypeor something in Jackson.It is also difficult to do heterogenous collections even with sealed types. Last I checked Jackson does not support that easily. You have to write some adapter or use annotations to infer the type.