跳到主要内容
版本:dev

Choose a Format

FormatUse it whenStart here
Xlang binaryData crosses language boundariesCross-language guide
Native binaryProducer and consumer are in the same languageLanguage guide
Row formatYou need random field access or analytics-style partial readsRow format spec
Fory JSONJava applications need high-performance standard JSONFory JSON guide

For Java, Scala, Kotlin, Python, C++, Go, and Rust, use native mode for same-language traffic. It avoids xlang's cross-language type mapping and metadata constraints, stays closer to each language's native type system, and supports broader language-specific object graphs. Use it when both producer and consumer are in the same language family and you want the native object model rather than a portable cross-language schema.

For Java/JVM-only systems, native mode is the replacement path for JDK serialization, Kryo, FST, Hessian, and Java-only Protocol Buffers payloads. For Python-only systems, native mode is the replacement path for pickle and cloudpickle.

Compatible mode is Fory's schema-evolution mode. It writes the metadata readers and writers need to tolerate schema differences. It is the default for xlang mode and native mode in implementations that expose the option.

Use compatible mode when services deploy independently or when fields may be added or deleted over time. Set compatible mode to false only when every reader and writer always uses the same schema and you want faster serialization and smaller size. For xlang payloads, set compatible mode to false only after verifying that every language uses the same schema, or when native types are generated from Fory schema IDL.

For xlang, all peers must agree on type identity. Name-based registration is easier to read in examples. Numeric IDs are smaller and faster, but they require coordination across every reader and writer.

Decision summary

Choose xlang or native mode when you need to reconstruct object graphs. Choose Row Format for trusted analytical data that benefits from random field access. Choose Fory JSON for standard JSON in Java applications. Use Fory IDL and the compiler when multiple teams need one schema-first contract; it generates models that use the relevant Fory capability.