Skip to main content

to_json_bytes

Function to_json_bytes 

Source
pub fn to_json_bytes(value: &Value) -> Result<Bytes, CodecError>
Available on crate feature transport only.
Expand description

Serialise a JSON value to bytes via sonic_rs (SIMD), no bridge.

The inverse of the JSON arm of parse. Reuses sonic_rs end-to-end so a transform that mutates a parsed JSON value re-emits it without ever touching serde_json.

ยงErrors

Returns CodecError::Json if sonic_rs fails to serialise the value.