Skip to main content

Fory v1.7.1 Released

· 4 min read
Shawn Yang
Apache Fory PMC Chair

The Apache Fory team is pleased to announce the 1.7.1 release. This patch release improves Java JSON interoperability, expands cross-language field tag IDs, and delivers correctness and compatibility fixes across multiple runtimes. See the Getting Started page to get the libraries for your platform.

Highlights​

  • Java JSON can write 64-bit integer values as strings, helping applications preserve exact values when JSON passes through JavaScript.
  • Java JSON now writes byte arrays as Base64 strings by default, providing a more compact and conventional representation for binary data.

JSON-Safe 64-Bit Integers​

JavaScript numbers cannot exactly represent every 64-bit integer. Fory JSON 1.7.1 adds the writeLongAsString builder option so applications can emit Java long and Long values as quoted decimal strings when data will pass through JavaScript or another number-limited consumer:

import org.apache.fory.json.ForyJson;

ForyJson json = ForyJson.builder().writeLongAsString(true).build();
String encoded = json.toJson(9_007_199_254_740_993L);

assert encoded.equals("\"9007199254740993\"");

The option is disabled by default. It also applies to the supported Long-like wrappers and to declared Long values inside arrays, collections, maps, and equivalent Scala and Kotlin containers. Readers accept both quoted and unquoted integer tokens regardless of the writer setting. See the Java JSON object mapping guide for the complete behavior.

Base64 Byte Arrays by Default​

Unannotated Java byte[] values now use quoted standard Base64 strings instead of JSON arrays of decimal byte values. For example, the bytes {1, -2, 3} are written as "Af4D". This matches the usual JSON representation for binary data and reduces encoding and parsing overhead for binary-heavy payloads.

This is a default representation change from Fory 1.7.0. The Base64 reader does not accept the old numeric-array representation. Applications that need to retain that representation can select it for an exact field or getter:

import org.apache.fory.json.annotation.JsonByteArray;

public final class Attachment {
@JsonByteArray(JsonByteArray.Format.ARRAY)
public byte[] content;
}

See the JSON annotations guide for JsonByteArray Base64 and numeric-array mapping details.

Features​

Bug Fixes​

Other Improvements​

New Contributors​

Full Changelog: v1.7.0...v1.7.1