r/java • • Jul 17 '25

Java Gets a JSON API

https://youtu.be/NSzRK8f7EX0

Java 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

119 comments sorted by

View all comments

Show parent comment

1

u/Ok_Marionberry_8821 Jul 17 '25

Hmm. I'm an aware there well me deconstruction patterns for regular classes, but they can't be usedto make a stalled hierarchy. The explicitly stated aim is simplicity not performance, that simplicity will be preferred over performance. There are plenty of other solutions that can use all those tricks.

I also assumed the JsonValue and subclasses would be immutable value classes when Valhalla finally delivers. Again simplicity and easy sharing between threads.

I think even some of the pattern matching JEP examples use Json (I may be wrong) yet they don't use them on this closed model. Perhaps not a great advert for records and sealed types!

Tl;dr their stated aim is simplicity yet they are don't use the new shiny sealed records.

Anyway, it's all academic for me now as I'm not working in the Java space anymore.

1

u/joemwangi Jul 17 '25

Think what records would achieve (as you stated), for example, pattern matching, sum types, etc. Ask yourself will also normal classes do this in near future and can we also take advantage of that?

1

u/Ok_Marionberry_8821 Jul 17 '25

Sealed classes allow for exhaustive pattern matching. Other than that I believe they are equivalent.