Cargo Features

[dependencies]
serde_json = { version = "1.0.133", default-features = false, features = ["std", "alloc", "preserve_order", "float_roundtrip", "arbitrary_precision", "raw_value", "unbounded_depth"] }

FEATURES

default = std

The std feature is set by default whenever serde_json is added without default-features = false somewhere in the dependency tree.

std default preserve_order?

Enables std of memchr and serde

memchr:

The 'std' feature permits the memchr crate to use the standard library. This permits this crate to use runtime CPU feature detection to automatically accelerate searching via vector instructions. Without the standard library,
this automatic detection is not possible.

Affects de::from_reader, serde_json::ser, read::IoRead

alloc

Provide integration for heap-allocated collections without depending on the rest of the Rust standard library. NOTE: Disabling both std and alloc features is not supported yet.

Enables alloc of serde

preserve_order = indexmap, std

Make serde_json::Map use a representation which maintains insertion order.
This allows data to be read into a Value and written back to a JSON string while preserving the order of map keys in the input.

float_roundtrip

Use sufficient precision when parsing fixed precision floats from JSON to ensure that they maintain accuracy when round-tripped through JSON. This comes at an approximately 2x performance cost for parsing floats compared to the default best-effort precision.

Unlike arbitrary_precision, this feature makes f64 -> JSON -> f64 produce output identical to the input.

arbitrary_precision

Use an arbitrary precision number representation for serde_json::Number. This allows JSON numbers of arbitrary size/precision to be read into a Number and written back to a JSON string without loss of precision.

Unlike float_roundtrip, this feature makes JSON -> serde_json::Number -> JSON produce output identical to the input.

Affects number::NumberFromString

raw_value

Provide a RawValue type that can hold unprocessed JSON during deserialization.

Affects read::Read.begin_raw_buffering, read::Read.end_raw_buffering

unbounded_depth

Provide a method disable_recursion_limit to parse arbitrarily deep JSON structures without any consideration for overflowing the stack. When using this feature, you will want to provide some other way to protect against stack overflows, such as by wrapping your Deserializer in the dynamically growing stack adapter provided by the serde_stacker crate. Additionally you will need to be careful around other recursive operations on the parsed result which may overflow the stack after deserialization has completed, including, but not limited to, Display and Debug and Drop impls.

Features from optional dependencies

In crates that don't use the dep: syntax, optional dependencies automatically become Cargo features. These features may have been created by mistake, and this functionality may be removed in the future.

indexmap preserve_order?