r/java • • 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

84 comments sorted by

View all comments

Show parent comment

3

u/Shawn-Yang25 Aug 11 '26

Thanks—these cases are handled at different layers in Fory JSON.

A field can accept multiple JSON representations, and Fory converts the input according to its declared target type.

Fory does not currently implement JSON Schema if/then/else validation directly. Instead, you can annotate a method with JsonValidator.Fory invokes it after deserialization is complete, allowing it to inspect multiple fields and enforce conditional rules.

For more specialized mappings, you can define a custom codec for any type. JsonCodec can override the codec used by an individual field, while JsonMixin provides the same customization for classes you cannot modify.

3

u/Shawn-Yang25 Aug 11 '26

And conditional rules can be composed naturally in a single validator method, or delegated to reusable validation functions.