Skip to main content

scalar_at_path

Function scalar_at_path 

Source
pub fn scalar_at_path<'a, I>(
    body: &[u8],
    segments: I,
) -> Result<String, JsonError>
where I: IntoIterator<Item = &'a str>,
Expand description

Follows segments into the object in body and returns the leaf scalar as a string: strings are decoded, numbers and bools use their source text.

ยงErrors

JsonError::PathNotScalar if a segment is missing or the leaf is an object, array, or null; JsonError::Invalid if body up to the leaf is not valid JSON.