{"id":28441579,"url":"https://github.com/apache/fory","last_synced_at":"2026-02-06T07:13:56.037Z","repository":{"id":181137820,"uuid":"633686625","full_name":"apache/fory","owner":"apache","description":"A blazingly fast multi-language serialization framework powered by JIT and zero-copy.","archived":false,"fork":false,"pushed_at":"2025-06-11T14:38:52.000Z","size":13579,"stargazers_count":3311,"open_issues_count":196,"forks_count":281,"subscribers_count":47,"default_branch":"main","last_synced_at":"2025-06-11T16:14:44.954Z","etag":null,"topics":["compression","cpp","cross-language","encoding","fast","golang","hacktoberfest","java","javascript","jit","lightning","marshalling","multiple-language","persistence","python","rpc","rust","serialization","transfer","zero-copy"],"latest_commit_sha":null,"homepage":"https://fory.apache.org/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apache.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-04-28T03:57:00.000Z","updated_at":"2025-06-11T14:38:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"c5d70753-d0fe-415c-958e-d97c7a0c440c","html_url":"https://github.com/apache/fory","commit_stats":{"total_commits":1047,"total_committers":77,"mean_commits":"13.597402597402597","dds":"0.30754536771728747","last_synced_commit":"a3a22381a67451327f1b000cad780f730db951d7"},"previous_names":["alipay/fury","fury-project/fury","apache/incubator-fury","apache/fury","apache/fory"],"tags_count":56,"template":false,"template_full_name":null,"purl":"pkg:github/apache/fory","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Ffory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Ffory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Ffory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Ffory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apache","download_url":"https://codeload.github.com/apache/fory/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Ffory/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259301645,"owners_count":22836970,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compression","cpp","cross-language","encoding","fast","golang","hacktoberfest","java","javascript","jit","lightning","marshalling","multiple-language","persistence","python","rpc","rust","serialization","transfer","zero-copy"],"created_at":"2025-06-06T05:05:36.215Z","updated_at":"2026-02-06T07:13:56.030Z","avatar_url":"https://github.com/apache.png","language":"Java","readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg width=\"65%\" alt=\"Apache Fory logo\" src=\"docs/images/logo/fory-horizontal.png\"\u003e\u003cbr\u003e\n\u003c/div\u003e\n\n[![Build Status](https://img.shields.io/github/actions/workflow/status/apache/fory/ci.yml?branch=main\u0026style=for-the-badge\u0026label=GITHUB%20ACTIONS\u0026logo=github)](https://github.com/apache/fory/actions/workflows/ci.yml)\n[![Slack Channel](https://img.shields.io/badge/slack-join-3f0e40?logo=slack\u0026style=for-the-badge)](https://join.slack.com/t/fory-project/shared_invite/zt-36g0qouzm-kcQSvV_dtfbtBKHRwT5gsw)\n[![X](https://img.shields.io/badge/@ApacheFory-follow-blue?logo=x\u0026style=for-the-badge)](https://x.com/ApacheFory)\n[![Maven Version](https://img.shields.io/maven-central/v/org.apache.fory/fory-core?style=for-the-badge)](https://search.maven.org/#search|gav|1|g:\"org.apache.fory\"%20AND%20a:\"fory-core\")\n[![Crates.io](https://img.shields.io/crates/v/fory.svg?style=for-the-badge)](https://crates.io/crates/fory)\n[![PyPI](https://img.shields.io/pypi/v/pyfory.svg?logo=PyPI\u0026style=for-the-badge)](https://pypi.org/project/pyfory/)\n\n**Apache Fory™** is a blazingly-fast multi-language serialization framework powered by **JIT compilation**, **zero-copy** techniques, and **advanced code generation**, achieving up to **170x performance improvement** while maintaining simplicity and ease of use.\n\n\u003chttps://fory.apache.org\u003e\n\n\u003e [!IMPORTANT]\n\u003e **Apache Fory™ was previously named as Apache Fury. For versions before 0.11, please use \"fury\" instead of \"fory\" in package names, imports, and dependencies, see [Fury Docs](https://fory.apache.org/docs/0.10/docs/introduction/) for how to use Fury in older versions**.\n\n## Key Features\n\n### 🚀 High-Performance Serialization\n\nApache Fory™ delivers excellent performance through advanced optimization techniques:\n\n- **JIT Compilation**: Runtime code generation for Java eliminates virtual method calls and inlines hot paths\n- **Static Code Generation**: Compile-time code generation for Rust, C++, and Go delivers peak performance without runtime overhead\n- **Zero-Copy Operations**: Direct memory access without intermediate buffer copies; row format enables random access and partial serialization\n- **Meta Packing \u0026 Sharing**: Class metadata packing and sharing reduces redundant type information across serializations\n\n### 🌍 Cross-Language Serialization\n\nThe **[xlang serialization format](docs/specification/xlang_serialization_spec.md)** enables seamless data exchange across programming languages:\n\n- **Automatic Type Mapping**: Automatic conversion between language-specific types ([type mapping](docs/specification/xlang_type_mapping.md))\n- **Reference Preservation**: Shared and circular references work correctly across languages\n- **Polymorphism**: Objects serialize/deserialize with their actual runtime types\n- **Schema Evolution**: Optional forward/backward compatibility for evolving schemas\n- **Automatic Serialization**: No IDL or schema definitions required; serialize any object directly without code generation\n\n### 📊 Row Format\n\nA cache-friendly **[row format](docs/specification/row_format_spec.md)** optimized for analytics workloads:\n\n- **Zero-Copy Random Access**: Read individual fields without deserializing entire objects\n- **Partial Operations**: Selective field serialization and deserialization for efficiency\n- **Apache Arrow Integration**: Seamless conversion to columnar format for analytics pipelines\n- **Multi-Language**: Available in Java, Python, Rust and C++\n\n### 🔒 Security \u0026 Production-Readiness\n\nEnterprise-grade security and compatibility:\n\n- **Class Registration**: Whitelist-based deserialization control (enabled by default)\n- **Depth Limiting**: Protection against recursive object graph attacks\n- **Configurable Policies**: Custom class checkers and deserialization policies\n- **Platform Support**: Java 8-24, GraalVM native image, multiple OS platforms\n\n## Protocols\n\nApache Fory™ implements multiple binary protocols optimized for different scenarios:\n\n| Protocol                                                                  | Use Case                       | Key Features                                           |\n| ------------------------------------------------------------------------- | ------------------------------ | ------------------------------------------------------ |\n| **[Xlang Serialization](docs/specification/xlang_serialization_spec.md)** | Cross-language object exchange | Automatic serialization, references, polymorphism      |\n| **[Java Serialization](docs/specification/java_serialization_spec.md)**   | High-performance Java-only     | Drop-in JDK serialization replacement, 100x faster     |\n| **[Row Format](docs/specification/row_format_spec.md)**                   | Analytics and data processing  | Zero-copy random access, Arrow compatibility           |\n| **Python Native**                                                         | Python-specific serialization  | Pickle/cloudpickle replacement with better performance |\n\nAll protocols share the same optimized codebase, allowing improvements in one protocol to benefit others.\n\n## Benchmarks\n\n\u003e **Note**: Different serialization frameworks excel in different scenarios. Benchmark results are for reference only.\n\u003e For your specific use case, conduct benchmarks with appropriate configurations and workloads.\n\n### Java Serialization Performance\n\nThe following benchmarks compare Fory against popular Java serialization frameworks. Charts labeled **\"compatible\"** show schema evolution mode with forward/backward compatibility enabled, while others show schema consistent mode where class schemas must match.\n\n**Test Classes**:\n\n- `Struct`: Class with [100 primitive fields](docs/benchmarks/java#Struct)\n- `MediaContent`: Class from [jvm-serializers](https://github.com/eishay/jvm-serializers/blob/master/tpc/src/data/media/MediaContent.java)\n- `Sample`: Class from [Kryo benchmark](https://github.com/EsotericSoftware/kryo/blob/master/benchmarks/src/main/java/com/esotericsoftware/kryo/benchmarks/data/Sample.java)\n\n**Serialization Throughput**:\n\n\u003cp align=\"center\"\u003e\n\u003cimg width=\"24%\" alt=\"Struct Serialization Compatible\" src=\"docs/benchmarks/java/compatible/bench_serialize_compatible_STRUCT_to_directBuffer_tps.png\"\u003e\n\u003cimg width=\"24%\" alt=\"MediaContent Serialization Compatible\" src=\"docs/benchmarks/java/compatible/bench_serialize_compatible_MEDIA_CONTENT_to_array_tps.png\"\u003e\n\u003cimg width=\"24%\" alt=\"MediaContent Serialization\" src=\"docs/benchmarks/java/serialization/bench_serialize_MEDIA_CONTENT_to_array_tps.png\"\u003e\n\u003cimg width=\"24%\" alt=\"Sample Serialization\" src=\"docs/benchmarks/java/serialization/bench_serialize_SAMPLE_to_array_tps.png\"\u003e\n\u003c/p\u003e\n\n**Deserialization Throughput**:\n\n\u003cp align=\"center\"\u003e\n\u003cimg width=\"24%\" alt=\"Struct Deserialization Compatible\" src=\"docs/benchmarks/java/compatible/bench_deserialize_compatible_STRUCT_from_directBuffer_tps.png\"\u003e\n\u003cimg width=\"24%\" alt=\"MediaContent Deserialization Compatible\" src=\"docs/benchmarks/java/compatible/bench_deserialize_compatible_MEDIA_CONTENT_from_array_tps.png\"\u003e\n\u003cimg width=\"24%\" alt=\"MediaContent Deserialization\" src=\"docs/benchmarks/java/deserialization/bench_deserialize_MEDIA_CONTENT_from_array_tps.png\"\u003e\n\u003cimg width=\"24%\" alt=\"Sample Deserialization\" src=\"docs/benchmarks/java/deserialization/bench_deserialize_SAMPLE_from_array_tps.png\"\u003e\n\u003c/p\u003e\n\n**Important**: Fory's runtime code generation requires proper warm-up for performance measurement:\n\nFor additional benchmarks covering type forward/backward compatibility, off-heap support, and zero-copy serialization, see [Java Benchmarks](docs/benchmarks/java).\n\n### Rust Serialization Performance\n\nFory Rust demonstrates competitive performance compared to other Rust serialization frameworks.\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"docs/benchmarks/rust/ecommerce_data.png\" width=\"70%\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"docs/benchmarks/rust/system_data.png\" width=\"70%\"\u003e\n\u003c/p\u003e\n\nFor more detailed benchmarks and methodology, see [Rust Benchmarks](benchmarks/rust_benchmark).\n\n### C++ Serialization Performance\n\nFory C++ demonstrates competitive performance compared to protobuf c++ serialization framework.\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"docs/benchmarks/cpp/throughput.png\" width=\"70%\"\u003e\n\u003c/p\u003e\n\nFor more detailed benchmarks and methodology, see [C++ Benchmarks](benchmarks/cpp_benchmark).\n\n### Go Serialization Performance\n\nFory Go demonstrates excellent performance compared to other go serialization frameworks:\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"docs/benchmarks/go/benchmark_combined.png\" width=\"95%\"\u003e\n\u003c/p\u003e\n\nFor more detailed benchmarks and methodology, see [Go Benchmark](benchmarks/go_benchmark).\n\n## Installation\n\n**Java**:\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003eorg.apache.fory\u003c/groupId\u003e\n  \u003cartifactId\u003efory-core\u003c/artifactId\u003e\n  \u003cversion\u003e0.14.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nSnapshots are available from `https://repository.apache.org/snapshots/` (version `0.15.0-SNAPSHOT`).\n\n**Scala**:\n\n```sbt\n// Scala 2.13\nlibraryDependencies += \"org.apache.fory\" % \"fory-scala_2.13\" % \"0.14.1\"\n\n// Scala 3\nlibraryDependencies += \"org.apache.fory\" % \"fory-scala_3\" % \"0.14.1\"\n```\n\n**Kotlin**:\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003eorg.apache.fory\u003c/groupId\u003e\n  \u003cartifactId\u003efory-kotlin\u003c/artifactId\u003e\n  \u003cversion\u003e0.14.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n**Python**:\n\n```bash\npip install pyfory\n\n# With row format support\npip install pyfory[format]\n```\n\n**Rust**:\n\n```toml\n[dependencies]\nfory = \"0.14\"\n```\n\n**C++**:\n\nFory C++ supports both CMake and Bazel build systems. See [C++ Installation Guide](https://fory.apache.org/docs/guide/cpp/#installation) for detailed instructions.\n\n**Golang**:\n\n```bash\ngo get github.com/apache/fory/go/fory\n```\n\n## Quick Start\n\nThis section provides quick examples for getting started with Apache Fory™. For comprehensive guides, see the [Documentation](#documentation).\n\n### Native Serialization\n\n**Always use native mode when working with a single language.** Native mode delivers optimal performance by avoiding the type metadata overhead required for cross-language compatibility. Xlang mode introduces additional metadata encoding costs and restricts serialization to types that are common across all supported languages. Language-specific types will be rejected during serialization in xlang-mode.\n\n#### Java Serialization\n\nWhen you don't need cross-language support, use Java mode for optimal performance.\n\n```java\nimport org.apache.fory.*;\nimport org.apache.fory.config.*;\n\npublic class Example {\n  public static class Person {\n    String name;\n    int age;\n  }\n\n  public static void main(String[] args) {\n    // Create Fory instance - should be reused across serializations\n    BaseFory fory = Fory.builder()\n      .withLanguage(Language.JAVA)\n      .requireClassRegistration(true)\n      // replace `build` with `buildThreadSafeFory` for Thread-Safe Usage\n      .build();\n    // Register your classes (required when class registration is enabled)\n    // Registration order must be consistent if id is not specified\n    fory.register(Person.class);\n    // Serialize\n    Person person = new Person();\n    person.name = \"chaokunyang\";\n    person.age = 28;\n    byte[] bytes = fory.serialize(person);\n    Person result = (Person) fory.deserialize(bytes);\n    System.out.println(result.name + \" \" + result.age);  // Output: chaokunyang 28\n  }\n}\n```\n\nFor detailed Java usage including compatibility modes, compression, and advanced features, see [Java Serialization Guide](docs/guide/java) and [java/README.md](java/README.md).\n\n#### Python Serialization\n\nPython native mode provides a high-performance drop-in replacement for pickle/cloudpickle with better speed and compatibility.\n\n```python\nfrom dataclasses import dataclass\nimport pyfory\n\n@dataclass\nclass Person:\n    name: str\n    age: pyfory.int32\n\n# Create Fory instance - should be reused across serializations\nfory = pyfory.Fory()\n# Register your classes (required when class registration is enabled)\nfory.register_type(Person)\nperson = Person(name=\"chaokunyang\", age=28)\ndata = fory.serialize(person)\nresult = fory.deserialize(data)\nprint(result.name, result.age)  # Output: chaokunyang 28\n```\n\nFor detailed Python usage including type hints, compatibility modes, and advanced features, see [Python Guide](docs/guide/python).\n\n#### Rust Serialization\n\nRust native mode provides compile-time code generation via derive macros for high-performance serialization without runtime overhead.\n\n```rust\nuse fory::{Fory, ForyObject};\n\n#[derive(ForyObject, Debug, PartialEq)]\nstruct Person {\n    name: String,\n    age: i32,\n}\n\nfn main() -\u003e Result\u003c(), fory::Error\u003e {\n    // Create Fory instance - should be reused across serializations\n    let mut fory = Fory::default();\n    // Register your structs (required when class registration is enabled)\n    fory.register::\u003cPerson\u003e(1);\n    let person = Person {\n        name: \"chaokunyang\".to_string(),\n        age: 28,\n    };\n    let bytes = fory.serialize(\u0026person);\n    let result: Person = fory.deserialize(\u0026bytes)?;\n    println!(\"{} {}\", result.name, result.age); // Output: chaokunyang 28\n    Ok(())\n}\n```\n\nFor detailed Rust usage including collections, references, and custom serializers, see [Rust Guide](docs/guide/rust).\n\n#### C++ Serialization\n\nC++ native mode provides compile-time reflection via the `FORY_STRUCT` macro for efficient serialization with zero runtime overhead.\n\n```cpp\n#include \"fory/serialization/fory.h\"\n\nusing namespace fory::serialization;\n\nstruct Person {\n    std::string name;\n    int32_t age;\n};\nFORY_STRUCT(Person, name, age);\n\nint main() {\n    // Create Fory instance - should be reused across serializations\n    auto fory = Fory::builder().build();\n    // Register your structs (required when class registration is enabled)\n    fory.register_struct\u003cPerson\u003e(1);\n    Person person{\"chaokunyang\", 28};\n    auto bytes = fory.serialize(person).value();\n    auto result = fory.deserialize\u003cPerson\u003e(bytes).value();\n    std::cout \u003c\u003c result.name \u003c\u003c \" \" \u003c\u003c result.age \u003c\u003c std::endl;  // Output: chaokunyang 28\n}\n```\n\nFor detailed C++ usage including collections, smart pointers, and error handling, see [C++ Guide](docs/guide/cpp).\n\n#### Scala Serialization\n\nScala native mode provides optimized serialization for Scala-specific types including case classes, collections, and Option types.\n\n```scala\nimport org.apache.fory.Fory\nimport org.apache.fory.config.Language\nimport org.apache.fory.serializer.scala.ScalaSerializers\n\ncase class Person(name: String, age: Int)\n\nobject Example {\n  def main(args: Array[String]): Unit = {\n    // Create Fory instance - should be reused across serializations\n    val fory = Fory.builder()\n      .withLanguage(Language.JAVA)\n      .requireClassRegistration(true)\n      .build()\n    // Register Scala serializers for Scala-specific types\n    ScalaSerializers.registerSerializers(fory)\n    // Register your case classes\n    fory.register(classOf[Person])\n    val bytes = fory.serialize(Person(\"chaokunyang\", 28))\n    val result = fory.deserialize(bytes).asInstanceOf[Person]\n    println(s\"${result.name} ${result.age}\")  // Output: chaokunyang 28\n  }\n}\n```\n\nFor detailed Scala usage including collection serialization and integration patterns, see [Scala Guide](docs/guide/scala).\n\n#### Kotlin Serialization\n\nKotlin native mode provides optimized serialization for Kotlin-specific types including data classes, nullable types, and Kotlin collections.\n\n```kotlin\nimport org.apache.fory.Fory\nimport org.apache.fory.config.Language\nimport org.apache.fory.serializer.kotlin.KotlinSerializers\n\ndata class Person(val name: String, val age: Int)\n\nfun main() {\n    // Create Fory instance - should be reused across serializations\n    val fory = Fory.builder()\n        .withLanguage(Language.JAVA)\n        .requireClassRegistration(true)\n        .build()\n    // Register Kotlin serializers for Kotlin-specific types\n    KotlinSerializers.registerSerializers(fory)\n    // Register your data classes\n    fory.register(Person::class.java)\n    val bytes = fory.serialize(Person(\"chaokunyang\", 28))\n    val result = fory.deserialize(bytes) as Person\n    println(\"${result.name} ${result.age}\")  // Output: chaokunyang 28\n}\n```\n\nFor detailed Kotlin usage including null safety and default value support, see [kotlin/README.md](kotlin/README.md).\n\n### Cross-Language Serialization\n\n**Only use xlang mode when you need cross-language data exchange.** Xlang mode adds type metadata overhead for cross-language compatibility and only supports types that can be mapped across all languages. For single-language use cases, always prefer native mode for better performance.\n\nThe following examples demonstrate serializing a `Person` object across Java and Rust. For other languages (Python, Go, JavaScript, etc.), simply set the language mode to `XLANG` and follow the same pattern.\n\n**Java**\n\n```java\nimport org.apache.fory.*;\nimport org.apache.fory.config.*;\n\npublic class XlangExample {\n  public record Person(String name, int age) {}\n\n  public static void main(String[] args) {\n    // Create Fory instance with XLANG mode\n    Fory fory = Fory.builder()\n      .withLanguage(Language.XLANG)\n      .build();\n\n    // Register with cross-language type id/name\n    fory.register(Person.class, 1);\n    // fory.register(Person.class, \"example.Person\");\n    Person person = new Person(\"chaokunyang\", 28);\n    byte[] bytes = fory.serialize(person);\n    // bytes can be deserialized by Rust, Python, Go, or other languages\n    Person result = (Person) fory.deserialize(bytes);\n    System.out.println(result.name + \" \" + result.age);  // Output: chaokunyang 28\n  }\n}\n```\n\n**Rust**\n\n```rust\nuse fory::{Fory, ForyObject};\n\n#[derive(ForyObject, Debug)]\nstruct Person {\n    name: String,\n    age: i32,\n}\n\nfn main() -\u003e Result\u003c(), Error\u003e {\n    let mut fory = Fory::default();\n    fory.register::\u003cPerson\u003e(1)?;\n    // fory.register_by_name::\u003cPerson\u003e(\"example.Person\")?;\n    let person = Person {\n        name: \"chaokunyang\".to_string(),\n        age: 28,\n    };\n    let bytes = fory.serialize(\u0026person);\n    // bytes can be deserialized by Java, Python, Go, or other languages\n    let result: Person = fory.deserialize(\u0026bytes)?;\n    println!(\"{} {}\", result.name, result.age);  // Output: chaokunyang 28\n}\n```\n\n**Key Points for Cross-Language Serialization**:\n\n- Use `Language.XLANG` mode in all languages\n- Register types with **consistent IDs or names** across all languages:\n  - **By ID** (`fory.register(Person.class, 1)`): Faster serialization, more compact encoding, but requires coordination to avoid ID conflicts\n  - **By name** (`fory.register(Person.class, \"example.Person\")`): More flexible, less prone to conflicts, easier to manage across teams, but slightly larger encoding\n- Type IDs/names must match across all languages for successful deserialization\n- Only use types that have cross-language mappings (see [Type Mapping](docs/specification/xlang_type_mapping.md))\n\nFor examples with **circular references**, **shared references**, and **polymorphism** across languages, see:\n\n- [Cross-Language Serialization Guide](docs/guide/xlang)\n- [Java Serialization Guide - Cross Language](docs/guide/java)\n- [Python Guide - Cross Language](docs/guide/python)\n\n### Row Format Encoding\n\nRow format provides zero-copy random access to serialized data, making it ideal for analytics workloads and data processing pipelines.\n\n#### Java\n\n```java\nimport org.apache.fory.format.*;\nimport java.util.*;\nimport java.util.stream.*;\n\npublic class Bar {\n  String f1;\n  List\u003cLong\u003e f2;\n}\n\npublic class Foo {\n  int f1;\n  List\u003cInteger\u003e f2;\n  Map\u003cString, Integer\u003e f3;\n  List\u003cBar\u003e f4;\n}\n\nRowEncoder\u003cFoo\u003e encoder = Encoders.bean(Foo.class);\nFoo foo = new Foo();\nfoo.f1 = 10;\nfoo.f2 = IntStream.range(0, 1000000).boxed().collect(Collectors.toList());\nfoo.f3 = IntStream.range(0, 1000000).boxed().collect(Collectors.toMap(i -\u003e \"k\"+i, i -\u003e i));\n\nList\u003cBar\u003e bars = new ArrayList\u003c\u003e(1000000);\nfor (int i = 0; i \u003c 1000000; i++) {\n  Bar bar = new Bar();\n  bar.f1 = \"s\" + i;\n  bar.f2 = LongStream.range(0, 10).boxed().collect(Collectors.toList());\n  bars.add(bar);\n}\nfoo.f4 = bars;\n\n// Serialize to row format (can be zero-copy read by Python)\nBinaryRow binaryRow = encoder.toRow(foo);\n\n// Deserialize entire object\nFoo newFoo = encoder.fromRow(binaryRow);\n\n// Zero-copy access to nested fields without full deserialization\nBinaryArray binaryArray2 = binaryRow.getArray(1);  // Access f2 field\nBinaryArray binaryArray4 = binaryRow.getArray(3);  // Access f4 field\nBinaryRow barStruct = binaryArray4.getStruct(10);   // Access 11th Bar element\nlong value = barStruct.getArray(1).getInt64(5);     // Access nested value\n\n// Partial deserialization\nRowEncoder\u003cBar\u003e barEncoder = Encoders.bean(Bar.class);\nBar newBar = barEncoder.fromRow(barStruct);\nBar newBar2 = barEncoder.fromRow(binaryArray4.getStruct(20));\n```\n\n#### Python\n\n```python\nfrom dataclasses import dataclass\nfrom typing import List, Dict\nimport pyarrow as pa\nimport pyfory\n\n@dataclass\nclass Bar:\n    f1: str\n    f2: List[pa.int64]\n\n@dataclass\nclass Foo:\n    f1: pa.int32\n    f2: List[pa.int32]\n    f3: Dict[str, pa.int32]\n    f4: List[Bar]\n\nencoder = pyfory.encoder(Foo)\nfoo = Foo(\n    f1=10,\n    f2=list(range(1000_000)),\n    f3={f\"k{i}\": i for i in range(1000_000)},\n    f4=[Bar(f1=f\"s{i}\", f2=list(range(10))) for i in range(1000_000)]\n)\n\n# Serialize to row format\nbinary: bytes = encoder.to_row(foo).to_bytes()\n\n# Zero-copy random access without full deserialization\nfoo_row = pyfory.RowData(encoder.schema, binary)\nprint(foo_row.f2[100000])           # Access element directly\nprint(foo_row.f4[100000].f1)        # Access nested field\nprint(foo_row.f4[200000].f2[5])     # Access deeply nested field\n```\n\nFor more details on row format, see [Row Format Specification](docs/specification/row_format_spec.md).\n\n## Documentation\n\n### User Guides\n\n| Guide                            | Description                                | Source                                          | Website                                                             |\n| -------------------------------- | ------------------------------------------ | ----------------------------------------------- | ------------------------------------------------------------------- |\n| **Java Serialization**           | Comprehensive guide for Java serialization | [java](docs/guide/java)                         | [📖 View](https://fory.apache.org/docs/guide/java/)                 |\n| **Python**                       | Python-specific features and usage         | [python](docs/guide/python)                     | [📖 View](https://fory.apache.org/docs/guide/python/)               |\n| **Rust**                         | Rust implementation and patterns           | [rust](docs/guide/rust)                         | [📖 View](https://fory.apache.org/docs/guide/rust/)                 |\n| **C++**                          | C++ implementation and patterns            | [cpp](docs/guide/cpp)                           | [📖 View](https://fory.apache.org/docs/guide/cpp/)                  |\n| **Scala**                        | Scala integration and best practices       | [scala](docs/guide/scala)                       | [📖 View](https://fory.apache.org/docs/guide/scala/)                |\n| **Cross-Language Serialization** | Multi-language object exchange             | [xlang](docs/guide/xlang)                       | [📖 View](https://fory.apache.org/docs/guide/xlang/)                |\n| **GraalVM**                      | Native image support and AOT compilation   | [graalvm_guide.md](docs/guide/graalvm_guide.md) | [📖 View](https://fory.apache.org/docs/guide/graalvm_serialization) |\n| **Development**                  | Building and contributing to Fory          | [DEVELOPMENT.md](docs/guide/DEVELOPMENT.md)     | [📖 View](https://fory.apache.org/docs/guide/development)           |\n\n### Protocol Specifications\n\n| Specification           | Description                    | Source                                                                        | Website                                                                             |\n| ----------------------- | ------------------------------ | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |\n| **Xlang Serialization** | Cross-language binary protocol | [xlang_serialization_spec.md](docs/specification/xlang_serialization_spec.md) | [📖 View](https://fory.apache.org/docs/specification/fory_xlang_serialization_spec) |\n| **Java Serialization**  | Java-optimized protocol        | [java_serialization_spec.md](docs/specification/java_serialization_spec.md)   | [📖 View](https://fory.apache.org/docs/specification/fory_java_serialization_spec)  |\n| **Row Format**          | Row-based binary format        | [row_format_spec.md](docs/specification/row_format_spec.md)                   | [📖 View](https://fory.apache.org/docs/specification/fory_row_format_spec)          |\n| **Type Mapping**        | Cross-language type conversion | [xlang_type_mapping.md](docs/specification/xlang_type_mapping.md)             | [📖 View](https://fory.apache.org/docs/specification/fory_xlang_serialization_spec) |\n\n## Compatibility\n\n### Schema Compatibility\n\nApache Fory™ supports class schema forward/backward compatibility across **Java, Python, Rust, and Golang**, enabling seamless schema evolution in production systems without requiring coordinated upgrades across all services. Fory provides two schema compatibility modes:\n\n1. **Schema Consistent Mode (Default)**: Assumes identical class schemas between serialization and deserialization peers. This mode offers minimal serialization overhead, smallest data size, and fastest performance: ideal for stable schemas or controlled environments.\n\n2. **Compatible Mode**: Supports independent schema evolution with forward and backward compatibility. This mode enables field addition/deletion, limited type evolution, and graceful handling of schema mismatches. Enable using `withCompatibleMode(CompatibleMode.COMPATIBLE)` in Java, `compatible=True` in Python, `compatible_mode(true)` in Rust, or `NewFory(true)` in Go.\n\n### Binary Compatibility\n\n**Current Status**: Binary compatibility is **not guaranteed** between Fory major releases as the protocol continues to evolve. However, compatibility **is guaranteed** between minor versions (e.g., 0.13.x).\n\n**Recommendations**:\n\n- Version your serialized data by Fory major version\n- Plan migration strategies when upgrading major versions\n- See [upgrade guide](docs/guide/java) for details\n\n**Future**: Binary compatibility will be guaranteed starting from Fory 1.0 release.\n\n## Security\n\n### Overview\n\nSerialization security varies by protocol:\n\n- **Row Format**: Secure with predefined schemas\n- **Object Graph Serialization** (Java/Python native): More flexible but requires careful security configuration\n\nDynamic serialization can deserialize arbitrary types, which may introduce risks. For example, the deserialization may invoke `init` constructor or `equals/hashCode` method; If the method body contains malicious code, the system will be at risk.\n\nFory enables class registration **by default** for dynamic protocols, allowing only trusted registered types.\n**Do not disable class registration unless you can ensure your environment is secure**.\n\nIf this option is disabled, you are responsible for serialization security. You should implement and configure a customized `ClassChecker` or `DeserializationPolicy` for fine-grained security control\n\nTo report security vulnerabilities in Apache Fory™, please follow the [ASF vulnerability reporting process](https://apache.org/security/#reporting-a-vulnerability).\n\n## Community and Support\n\n### Getting Help\n\n- **Slack**: Join our [Slack workspace](https://join.slack.com/t/fory-project/shared_invite/zt-36g0qouzm-kcQSvV_dtfbtBKHRwT5gsw) for community discussions\n- **Twitter/X**: Follow [@ApacheFory](https://x.com/ApacheFory) for updates and announcements\n- **GitHub Issues**: Report bugs and request features at [apache/fory](https://github.com/apache/fory/issues)\n- **Mailing Lists**: Subscribe to Apache Fory mailing lists for development discussions\n\n### Contributing\n\nWe welcome contributions! Please read our [Contributing Guide](CONTRIBUTING.md) to get started.\n\n**Ways to Contribute**:\n\n- 🐛 Report bugs and issues\n- 💡 Propose new features\n- 📝 Improve documentation\n- 🔧 Submit pull requests\n- 🧪 Add test cases\n- 📊 Share benchmarks\n\nSee [Development Guide](docs/guide/DEVELOPMENT.md) for build instructions and development workflow.\n\n## License\n\nApache Fory™ is licensed under the [Apache License 2.0](LICENSE).\n","funding_links":[],"categories":["Java"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapache%2Ffory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapache%2Ffory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapache%2Ffory/lists"}