github apache/fory v1.4.0

one day ago

Highlights

  • Introduced Fory JSON for Java, featuring high-performance code generation, rich annotations and mix-ins, dynamic properties, and support for Android and GraalVM native images.
  • Improved performance, safety, and compatibility with a configurable container memory budget, more efficient stream deserialization, Python 3.14 support, and numerous cross-runtime fixes.

Fory JSON for Java

Fory 1.4.0 introduces Fory JSON, a high-performance, thread-safe JSON serialization framework for Java applications. It provides direct mapping between standard JSON and idiomatic Java domain objects, making it suitable for HTTP APIs, browser traffic, logs, configuration, and other interoperable text payloads.

Its main capabilities include:

  • High-performance serialization: optimized readers and writers work with interpreted and runtime-generated serializers to accelerate both JSON encoding and decoding.
  • Rich Java object mapping: ordinary classes, Java records, immutable creator-based classes, common JDK types, and generic containers are supported.
  • Flexible customization: annotations, mix-ins, and custom codecs adapt application types to JSON, covering property names, order, inclusion, creators, polymorphism, unwrapped values, dynamic properties, and specialized representations.
  • Broad platform support: supports JDK 8 and later, Android, and GraalVM native images.

Add the fory-json artifact to your application:

<dependency>
  <groupId>org.apache.fory</groupId>
  <artifactId>fory-json</artifactId>
  <version>1.4.0</version>
</dependency>

ForyJson is immutable and thread-safe after construction, so one instance can be reused across threads:

import org.apache.fory.json.ForyJson;

public final class JsonExample {
  private static final ForyJson JSON = ForyJson.builder().build();

  public static final class User {
    public long id;
    public String name;

    public User() {}
  }

  public static void main(String[] args) {
    User user = new User();
    user.id = 7;
    user.name = "Alice";

    // Serialize to JSON text and deserialize from text.
    String text = JSON.toJson(user);
    User fromText = JSON.fromJson(text, User.class);

    // Serialize directly to UTF-8 bytes and deserialize without an intermediate String.
    byte[] utf8 = JSON.toJsonBytes(user);
    User fromUtf8 = JSON.fromJson(utf8, User.class);
  }
}

See the Fory JSON documentation for the complete type model, annotations and mix-ins, dynamic properties, custom serializers, security controls, and Android or GraalVM setup.

Features

Bug Fix

Other Improvements

New Contributors

Full Changelog: v1.3.0...v1.4.0

Don't miss a new fory release

NewReleases is sending notifications on new releases.