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.0will be serialized as18instead of18.0. - avx512
-
Enable avx512, requires Rust 1.89 or later, and also enable
avx512ftarget featureEnables avx512 of sonic-simd