from_slice

Function from_slice 

Source
pub fn from_slice<T: Facet<'static>>(input: &[u8]) -> Result<T, JsonError>
Expand description

Deserialize JSON from a byte slice into an owned type.

This is the recommended default for most use cases. The input does not need to outlive the result, making it suitable for deserializing from temporary buffers (e.g., HTTP request bodies).

Types containing &str fields cannot be deserialized with this function; use String or Cow<str> instead. For zero-copy deserialization into borrowed types, use from_slice_borrowed.

Note: For rich error diagnostics with source code display, prefer from_str which can attach the source string to errors.