JEP 540: Simple JSON API (Now in Incubator)
openjdk.org
JEP 540: Simple JSON API (Now in Incubator)
1–10 of 83 posts
Re: JEP 540: Simple JSON API (Now in Incubator)
#2I already have one of these (I'm sure I'm not alone). It's about 500 lines.
I found I'm not a huge fan of the JAX-B-ish style serialization of Java objects for JSON. I don't want to really downplay them, they certainly have their uses, they're very popular, I just don't like fighting them. Hand writing JSON marshaling code has not been arduous for me (notably with my utility layer). (I also, philosophically, strive to avoid "magic" in my code as much as practical.)
Of course, I still need a parser, I'm using GSONs parser, which means I'm still dragging in the whole bean level serialization infrastructure. I just don't use it. And while I've done JSON parsers before, I felt it was something better to import than maintain myself. So, in that sense, it's a mixed bag.
But, I do enjoy using it.
This will be a worthwhile JDK capability. Ideally it can replace mine.
Re: JEP 540: Simple JSON API (Now in Incubator)
#31. An HTTP server library/framework
2. A JSON library
We got a decently-performing and unopionated HTTP server in JDK 18 with "HttpHandlers" and "SimpleFileServer" plus "jwebserver" CLI
It later received Virtual Thread support, which made performance + scalability very competitive.
With a JSON module, you finally won't NEED to rely on external deps to build a basic JVM web service without pain.
Now, we just need a proper CLI framework like picocli, or at least "argparse" from Python stdlib...
Re: JEP 540: Simple JSON API (Now in Incubator)
#4I find it interesting to note that nowhere in this JEP is the word "serialization", which is what most people might associate with JSON libs. Or rather, they are studiously ignoring that feature and just improving the ergonomics of interacting with JSON.
Re: JEP 540: Simple JSON API (Now in Incubator)
#5Re: JEP 540: Simple JSON API (Now in Incubator)
#6One of my favorite things about Jackson was being able to arbitrarily navigate through the document with a rich and fluent API (JsonNode) in jackson.databind, which this JEP at least conceptually borrows from with the JsonValue abstraction. Both of these are better than how some of the other implementations do it, where you are effectively working with glorified Map
Re: JEP 540: Simple JSON API (Now in Incubator)
#7Re: JEP 540: Simple JSON API (Now in Incubator)
#8Does anyone know how this behaves when encountering a repeated key in an object? (RFC8259 states that keys SHOULD be unique, which makes that generally allowed and implementations all behave slightly differently).
Re: JEP 540: Simple JSON API (Now in Incubator)
#9Including this in the standard library speaks to how much a citizen JSON has become, where a language simply can't afford to not consider it. I find it interesting to note that nowhere in this JEP is the word "serialization", which is what most people might associate with JSON libs. Or rather, they are studiously ignoring that feature and just improving the ergonomics of interacting with JSON.
Re: JEP 540: Simple JSON API (Now in Incubator)
#10Including this in the standard library speaks to how much a citizen JSON has become, where a language simply can't afford to not consider it. I find it interesting to note that nowhere in this JEP is the word "serialization", which is what most people might associate with JSON libs. Or rather, they are studiously ignoring that feature and just improving the ergonomics of interacting with JSON.