Ralf is a software engineer with a history as Eclipse committer and project lead.
In recent years, he devoted himself to JavaScript technologies and helped pulling off …
Earlier this year I’ve introduced Minimal JSON, a slim and fast Java library for reading and writing JSON. In contrast to object mappers such as Gson or Jackson, Minimal JSON does not more than reading a JSON text into a memory-efficient Java representation that can be accessed, modified and serialized to JSON again. You can see some code examples on the project page.
We’re using this library in the Eclipse RAP project for six month now (it’s also part of RAP 2.1) for the entire client/server communication and it worked smoothly from the beginning. However, I kept improving this little tool ever since and actually using it in a project didn’t let me run out of ideas.
There was still room for optimization by implementing proper buffering in the parser and the writer. So I’ve spent some nice hours this summer tweaking the parser code and running benchmarks. Especially when reading from (and writing to) streams instead of strings, the current version is much faster than the first one.
This benchmark compares five JSON libraries reading and writing a 30kB example message. You may notice Jackson’s exceptional writing performance, which is to my knowledge achieved mostly by caching. I’m not sure if this would still qualify as “minimal”, but it’s certainly an interesting research topic for Minimal JSON as well.
Other features on the road map include streaming support, custom formatters, and some useful helpers such as methods for creating JSON arrays from Java arrays easily. These things will come, but I’ll take my time evaluating alternatives and looking for the best approach. While I’m eager to make the library more flexible and easy to use, I’m also willing to keep it small and simple.
Minimal JSON 0.9.1 is now available on Maven Central. The jar is 23kB, and it’s also a complete OSGi bundle. Some slight API changes are likely before 1.0. Apart from that, I think I can say that this version is stable and ready for production.
Ralf is a software engineer with a history as Eclipse committer and project lead.
In recent years, he devoted himself to JavaScript technologies and helped pulling off …