Cargo Features

Sonic-rs has no features set by default.

[dependencies]
sonic-rs = { version = "0.5.7", features = ["arbitrary_precision", "sort_keys", "utf8_lossy", "sanitize", "non_trailing_zero", "avx512"] }
arbitrary_precision

Use an arbitrary precision number type representation when parsing JSON into sonic_rs::Value. This allows the JSON numbers will be serialized without loss of precision.

sort_keys

Sort the keys when serializing sonic_rs::Value.

utf8_lossy

Allow to parse JSON with invalid UTF-8 and UTF-16 characters. Will replace them with \uFFFD (displayed as �).

sanitize

Enable sanitize, maybe cause 30% performance-loss in serialize.

non_trailing_zero

Serialize floating point numbers without trailing zeros if the float can be represented as an integer without loss of precision. For example, 18.0 will be serialized as 18 instead of 18.0.

avx512

Enable avx512, requires Rust 1.89 or later, and also enable avx512f target feature

Enables avx512 of sonic-simd