Message Type
Define structured data types with typed fields, field IDs, and explicit optional fields.
A blazingly-fast multi-language serialization framework for idiomatic domain objects, Schema IDL, and cross-language data exchange.
Fory brings together cross-language serialization, idiomatic object support, Schema IDL/code generation, reference tracking, schema evolution, and row-format access.
Serialize in one supported runtime and deserialize in another with the xlang wire format.
OBJECTSWork with Java classes, Python dataclasses, Go structs, Rust/C++ structs, and generated or annotated models.
IDLDefine schemas once with optional fields, refs, IDs, unions, and services, then generate native code.
ROWRead fields, arrays, and nested values without deserializing the whole object; integrate with Arrow where supported.
FASTUse Java/JavaScript JIT serializers, Rust/C++/Swift macros, C# source generators, Kotlin KSP, and Dart build_runner output.
MULTIUse Fory from Java, Python, C++, Go, Rust, JavaScript/TypeScript, C#, Swift, Dart, Scala, Kotlin, and Android.
Create a native object in your language, then serialize and deserialize it with one-line Fory calls.
Java supports xlang and native modes, JIT serializers, schema evolution, and Java-native object graph features.
<dependency>
<groupId>org.apache.fory</groupId>
<artifactId>fory-core</artifactId>
<version>1.1.0</version>
</dependency>
import org.apache.fory.Fory;
public record Person(String name, int age) {}
Fory fory = Fory.builder()
.withXlang(true)
.build();
fory.register(Person.class, "Person");
byte[] bytes = fory.serialize(new Person("Alice", 30));
Person out = (Person) fory.deserialize(bytes);
Fory IDL starts with familiar message definitions, then adds unions and reference-aware fields for data models that ordinary IDLs tend to flatten.
Define structured data types with typed fields, field IDs, and explicit optional fields.
Map one-of-several cases to tagged unions, and to native union or sum types where supported.
Use ref-tracked fields when the same object can be shared or a graph contains cycles.
package example;
message Dog {
string name = 1;
int32 bark_volume = 2;
}
message Cat {
string name = 1;
int32 lives = 2;
}
union Animal {
Dog dog = 1;
Cat cat = 2;
}
message Node {
string value = 1;
ref Node parent = 2;
list<ref Node> children = 3;
}
Fory combines efficient binary encoding with highly optimized serializers, from JIT compilation to statically generated code.
View full benchmark chartsUse JIT serializers, source generators, macros, KSP, and build_runner where each runtime supports them.
Encode typed objects into an efficient binary format for fast serialization and deserialization.
Use one serialization layer, but choose the payload surface by the boundary your data crosses.
Use xlang when services in different languages need to exchange the same typed payload directly.
Use native mode when objects stay inside one runtime and object graph fidelity matters.
Use row format for partial reads and analytics workloads that should not rebuild whole objects.
Choose the wire mode for each boundary, promote shared models into Fory IDL when contracts need to last, then validate the exact path with per-language benchmarks.
Use xlang for portable payloads shared across languages; use native mode for same-runtime traffic that needs broader runtime-specific object models.
Usage guideDefine Fory IDL once, generate type-safe native models across languages, and use optional fields, refs, unions, or services when contracts evolve.
Schema IDL guideCompare serialization throughput, deserialization throughput, payload size, and reproduction steps for the runtime you plan to ship.
Benchmark charts