This is an automated email from the ASF dual-hosted git repository. chaokunyang pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/fory-site.git
commit cc328c638a778bfb695a12d649da7f9ccd8c60a9 Author: chaokunyang <[email protected]> AuthorDate: Mon Aug 31 06:16:43 2026 +0000 🔄 synced local 'docs/json/' with remote 'docs/json/' --- docs/json/kotlin.md | 11 +++++++++-- docs/json/object-mapping.md | 9 +++++++++ docs/json/scala.md | 5 +++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/docs/json/kotlin.md b/docs/json/kotlin.md index 0d004a3433f..4b6bc182200 100644 --- a/docs/json/kotlin.md +++ b/docs/json/kotlin.md @@ -87,6 +87,12 @@ val text = json.toJson(Account(7u, "Alice"), accountType) val decoded = json.fromJson(text, accountType) ``` +Use `ForyJsonKotlin.builder().writeLongAsString(true)` when signed `Long` and unsigned `ULong` +values must be emitted as quoted decimal strings. The setting also applies to their declared +collection and map values, nullable values, Kotlin value classes backed by them, `ULongArray`, and +the Java Long-like wrappers supported by the core JSON runtime. Readers accept both quoted and +unquoted integer tokens. + `jsonTypeRef<T>()` is a type token, not a codec lookup. Construct it once and reuse it. A Java `Class` or ordinary Java `TypeRef` cannot express distinctions such as `List<Account?>`, `UInt`, or a logical value class lowered to a primitive carrier. @@ -363,5 +369,6 @@ See [Troubleshooting](troubleshooting.md) for Kotlin metadata, nullability, gene Android shrinking, Native Image, syntax, limits, custom codecs, subtypes, and root-operation failures. -See [Kotlin JSON benchmarks](../benchmarks/json/kotlin/README.md) for the workloads and setup -used to compare Fory JSON Kotlin, kotlinx.serialization, Moshi, and Jackson Kotlin. +The source-aligned four-library benchmark methodology and publication status are in the +[Kotlin JSON benchmark report](../benchmarks/json/kotlin/README.md). No Kotlin result is inferred +from the Java or Scala benchmark. diff --git a/docs/json/object-mapping.md b/docs/json/object-mapping.md index e64b7116b1a..537c8486086 100644 --- a/docs/json/object-mapping.md +++ b/docs/json/object-mapping.md @@ -215,6 +215,7 @@ original key type. Null map keys are rejected. | Builder method | Default | User-visible effect | | -------------------------------------- | ----------------------------------------- | ---------------------------------------------------------- | | `writeNullFields(boolean)` | `false` | Default inclusion of null object properties | +| `writeLongAsString(boolean)` | `false` | Write built-in 64-bit integer values as decimal strings | | `withCodegen(boolean)` | `true` | Enable generated object codecs | | `withAsyncCompilation(boolean)` | `true` | Compile generated codecs asynchronously | | `withFieldMode(boolean)` | `false` | When true, discover fields without getters/setters | @@ -225,6 +226,14 @@ original key type. Null map keys are rejected. | `registerCodec(type, codec)` | None | Replace an eligible exact class's complete JSON codec | | `registerMixin(mixinType)` | None | Apply one annotation Mixin to its exact declared target | +Enable `writeLongAsString(true)` when 64-bit integer values must pass through JavaScript without +`Number` precision loss. The setting writes built-in `long`/`Long`, `AtomicLong`, +`AtomicLongArray`, and `OptionalLong` values as quoted decimal strings. It also follows declared +Long children through arrays, collections, map values, `Optional<Long>`, `AtomicReference<Long>`, +and equivalent language-module containers. Readers accept both numeric and quoted integer tokens +regardless of this setting. Custom codecs and occurrence-level codec or format annotations retain +their own output shape. + Concurrency-level and buffer-retention limits must be positive. The cached-field-name limit applies independently to each reader; zero disables this cache. It bounds only cached field names, not names accepted from the input. The buffer-retention setting does not limit JSON input or output diff --git a/docs/json/scala.md b/docs/json/scala.md index 04b9637f31a..f1bdf4a574d 100644 --- a/docs/json/scala.md +++ b/docs/json/scala.md @@ -41,6 +41,11 @@ val person = json.fromJson(text, classOf[Person]) ``` Reuse the resulting `ForyJson` instance. It is immutable and thread-safe after construction. +Use `ForyJsonScala.builder().writeLongAsString(true)` to emit Scala `Long` values, including +declared collection and map values, `Option[Long]`, `Long`-backed value classes, and Java Long-like +wrappers as quoted decimal strings. Readers accept both quoted and unquoted integer tokens. +Use `ScalaTypeRef` when a parameterized declaration contains `Long` because normal JVM signatures +can erase Scala value-type arguments to `Object`. ## Case classes and annotations --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
