dagblog.
← Archive

Five plus one absurd reasons the JDK lacks JSON support


Whenever I work with JSON in Java, I feel like we’re a hundred and fifty years behind the times. I mostly use the excellent Jackson library (no, it’s not a descendant of the pop icon Michael Jackson), but even that feels like using a cannon to shoot sparrows. I have a very simple structure {"l":"0","u":"1","v":1338207547} that I’d like to deserialize into a map. I really don’t understand why the standard Java JDK doesn’t already have a dead-simple API that lets me do it. I can think of several explanations.

  • Someone gets a kick out of the idea of a 100 MB WAR. You don’t need to build a complex application to get there. A developer only needs to solve a few basic problems.
  • The people behind Apache Jakarta Commons don’t know what they’re doing. That doesn’t stop most applications from using their libraries.
  • JCP is completely useless as a process for extending Java, since it fails to add new and necessary APIs . By the way, how long have we been waiting for a new API for working with dates?
  • I can’t rule out the possibility that my demands on something called the JDK, the standard development kit, are wildly excessive, and that for the past ten years we’ve all got by with more or less the same tools.
  • Work on JSON is tied to Java EE for reasons I can’t fathom. By that logic, the JDK couldn’t include, for instance, an HTTP server or JAXB, let alone something as absurd as an embedded database.
  • JSON is a technology nobody at Oracle has heard of. Or perhaps they associate it with a competitor, JavaScript.

I really don’t understand it. Adding new APIs and extending the JDK are backward-compatible changes, unlike changing the language syntax. We can go round in circles about a bloated JDK being a problem too, but that’s exactly why we’re calling for modularity. It’s a kind of deadlock, and now we’re just waiting to see where things give way.

Where Java could be improved with less risk, it isn’t happening. Instead its authors are taking on the risky business of changing the syntax.

Medium version

Related articles

Related CZ Podcast episodes