Skip to main content

from_projected_json_slice

Function from_projected_json_slice 

Source
pub fn from_projected_json_slice<T>(
    body: &[u8],
    unwrap_field: &str,
    map_field: Option<&str>,
) -> Result<T, Error>
Expand description

Deserializes a projected JSON response body from bytes.

The top-level unwrap_field is selected first. When map_field is set, the unwrapped value must be an array of objects and that field is selected from every item. Missing fields become JSON null, allowing the projected Rust type’s normal serde rules to distinguish optional and required values.

§Errors

Returns an error when the response does not have the configured container shape or when the projected JSON cannot be deserialized as T.