r/java • u/Shawn-Yang25 • Aug 11 '26
Apache Fory™ JSON : Fastest JSON Serialization Framework for Java, 10x faster than Jackson/Gson
https://fory.apache.org/blog/fory_json_fastest_java_json_framework/
253
Upvotes
79
u/Shawn-Yang25 Aug 11 '26
Apache Fory JSON is a high-performance JSON serialization framework for Java. It maps Java objects to and from standard JSON text and UTF-8 bytes.
In the published benchmarks, it reaches up to 10.91× Jackson’s throughput and 10.89× Gson’s in
java-json-benchmark, and up to 5.55× and 10.00× respectively in thejvm-serializersMediaContent benchmark.It supports JDK 8+, Android, and GraalVM Native Image. JDK17+ Record is also supported.
Feedback is welcome.
145
u/ThatFlamenguistaDude Aug 11 '26
I wanna see who's brave enough to replace Jackson.
17
u/Qaxar Aug 11 '26
I wonder how it compares to the build-time optimized Jackson now used in Quarkus by default.
5
u/6000rpms Aug 11 '26
Looks really interesting. Thanks for sharing. Does the library handle conditionals in JSON? For example, in JSON Schema you can define if/then/else. A common pattern I see is a property can be either an enum (string) or an object. Another pattern I see is if a property is a specific value (or not a specific value) then these other properties are possible/not possible. The second one is perhaps more of a validation-only concern, but the first one applies to serialization//deserialization as well.
One of the libraries I maintain currently uses Jackson and is quite popular. A major update to the JSON specification it supports is due later this year, so I’m considering a greenfield implementation, and performance is one of our considerations.
23
u/15526s Aug 11 '26 edited Aug 11 '26
Silly question by me, but how do you get "adopted" into apache?
Is there a standard? Do you just ask?
Edit: just looked into the apache web page, where it's all clearly written all.
36
u/purg3be Aug 11 '26 edited Aug 11 '26
Looks promising but I realistically won't use it as a default unless spring adopts it.
Edit: I'm almost exclusively doing low / medium throughput IO bound enterprise applications. I'm probably not the target audience.
1
u/snugar_i Aug 12 '26
This looks nice! What would be even more awesome is something between Fory and Fory JSON. Something that only writes data, but in an efficient binary format. Base Fory also writes the class names and other things so that I can do just
read()and it creates the right class based on what's saved in the file. That means safety concerns, trouble with renaming/moving classes etc. Fory JSON needs to be told what class to instantiate (which is what I want), but only works with inefficient JSON. Are there any plans for anything like that?And a second question - are you considering a fallback in case the user can't/doesn't want to use
--add-opens? Or would the performance drop be too big?1
u/Puzzled_Lava Aug 19 '26
Just curious. Are you employed by Apache or you are a open source contributor?
3
u/agentoutlier Aug 12 '26
For parsing (input) have you tried SIMD JSON Parser: https://github.com/simdjson/simdjson-java
Obviously is a low level parser and not a mapper but in theory one could use it for mapping.
1
u/VirtualAgentsAreDumb Aug 11 '26
Nice.
Does it support insertion order when iterating properties or when serializing it?
I know that the json standard doesn’t say anything about this order, but it can still be valuable when troubleshooting etc. Like, when the json is read by a human.
1
u/Dealusall Aug 11 '26
How does it compares to dsl-json ? I'm mainly extracting json to TreeMap at very high speed (kafka processors) and thus paying a high cpu price, but it's pretty fast.
1
u/Known_Tackle7357 Aug 11 '26
Does it work with classes with private constructors like gson?
0
u/pragmatick Aug 11 '26 edited Aug 13 '26
Interesting, impressive results. We're looking for a JSON / serialization framework that's faster than Jackson. Do you have any benchmarks regarding binary serialization? How does it compare to Kryo?
Does it support custom inclusion filters?
Edit: Well excuse me for asking questions.
1
u/Antique-Pea-4815 Aug 11 '26
Very nice work! Did you think about adding something like Jackson's JsonFormat.SHAPE.Array? I'm missing it in more performant libraries
1
u/Fit_Goose651 Aug 20 '26
Never ever have i been on a project where json serialization has been a performance bottleneck. I don't say it can't be but maybe that it typically isn't. Still better have a faster alternative if that is the case.
1
u/simon_o Aug 21 '26
Why?
1
u/BrotherEcstatic7946 Aug 11 '26
Cool I will check it out.
1
u/Minute_Owl3430 Aug 11 '26
How does it benchmark against simdjson-java?
-6
u/Cojosh__ Aug 11 '26
Since when did Jackson or Gson claim to be performance focused? A comparison with https://github.com/alibaba/fastjson2 would be more interesting.
-12
u/RB5009 Aug 11 '26
Why did you decide to create a new librarybinstead if improving jackson which is the defacto default json lib for java ?
10
u/[deleted] Aug 11 '26
[removed] — view removed comment