title: Cross-Language Serialization Guide sidebar_position: 0 id: xlang_serialization_index license: | Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Apache Fory™ xlang (cross-language) serialization enables seamless data exchange between different programming languages. Serialize data in one language and deserialize it in another—without IDL definitions, schema compilation, or manual data conversion.
| Language | Status | Package |
|---|---|---|
| Java | ✅ | org.apache.fory:fory-core |
| Python | ✅ | pyfory |
| C++ | ✅ | Bazel/CMake build |
| Go | ✅ | github.com/apache/fory/go/fory |
| Rust | ✅ | fory crate |
| JavaScript | ✅ | @apache-fory/fory |
Use xlang mode when:
Use language-native mode when:
import org.apache.fory.*; import org.apache.fory.config.*; public class Person { public String name; public int age; } Fory fory = Fory.builder() .withLanguage(Language.XLANG) .build(); fory.register(Person.class, "example.Person"); Person person = new Person(); person.name = "Alice"; person.age = 30; byte[] bytes = fory.serialize(person); // Send bytes to Python, Go, Rust, etc.
import pyfory from dataclasses import dataclass @dataclass class Person: name: str age: pyfory.Int32Type fory = pyfory.Fory() fory.register_type(Person, typename="example.Person") # Receive bytes from Java person = fory.deserialize(bytes_from_java) print(f"{person.name}, {person.age}") # Alice, 30
| Topic | Description |
|---|---|
| Getting Started | Installation and basic setup for all languages |
| Type Mapping | Cross-language type mapping reference |
| Serialization | Built-in types, custom types, reference handling |
| Zero-Copy | Out-of-band serialization for large data |
| Row Format | Cache-friendly binary format with random access |
| Troubleshooting | Common issues and solutions |
For language-specific details and API reference: