I've been working on SJF4J, a unified JSON API for Java built around a simple idea: treat Java objects like JSON.

It combines runtime flexibility with compile-time performance across multiple backends, including Jackson 2.x / 3.x, Fastjson2, and Gson.

But can a unified API actually outperform the libraries underneath it?

Java JSON Binding Benchmarks

SJF4J provides a compiled binding API that generates backend-specific Java code through annotation processing, avoiding much of the overhead associated with generic runtime binding.

To explore its performance, I ran JMH benchmarks comparing SJF4J Compiled Binding with direct library binding and, for Jackson, Blackbird.

JVM — JDK 25

JVM Binding Benchmarks

The JVM results show that compiled binding can match or outperform native library implementations across a range of workloads.

For example, in the 100KB Clients POJO deserialization benchmarks:

  • 3.13× the performance of Jackson 2 Native
  • 2.43× the performance of Gson Native

The improvements vary considerably by backend, data model, and operation. Some workloads show substantial gains, while others perform similarly to native binding.

The interesting part isn't any single performance ratio. It's that a unified API doesn't necessarily have to sacrifice performance.

GraalVM Native Image

I also tested SJF4J with GraalVM Native Image, using ahead-of-time compiled executables rather than the JVM.

GraalVM Native Image Benchmarks

The results are particularly interesting here.

For selected 100KB POJO deserialization workloads, SJF4J Compiled achieved:

  • 3.40× the performance of Jackson 2 Native (Clients)
  • 5.50× the performance of Fastjson2 Native (Users)

Compile-time generated code can be especially valuable in an AOT environment, where runtime reflection and dynamic optimization have different characteristics.

These are independent JVM and Native Image benchmark suites, not direct cross-environment comparisons.

All benchmarks use JMH, and the full configurations, workloads, and results are publicly available. Results are workload-specific and were collected on GitHub Actions runners.

Beyond JSON Binding

And there's more to explore beyond JSON binding.

SJF4J also brings JSONPath, JSON Schema, JSON Patch, object mapping, and JDBC result mapping directly to ordinary Java objects.

For example, modifying a POJO with JSONPath:

JsonPath.parse("$.address.city").put(user, "Shanghai"); 

No intermediate JSON tree required.

For performance-sensitive operations, SJF4J also provides compile-time optimized navigation, validation, and mapping APIs.

The broader goal is simple: JSON semantics, native Java objects, and compile-time performance.

Explore SJF4J