sonic_rs::lazyvalue

Function get_from_slice_unchecked

Source
pub unsafe fn get_from_slice_unchecked<Path: IntoIterator>(
    json: &[u8],
    path: Path,
) -> Result<LazyValue<'_>>
where Path::Item: Index,
Expand description

Gets a field from a path. And return it as a Result<LazyValue>.

If not found, return an error. If the path is empty, return the whole JSON as a LazyValue.

The Item of the path should implement the Index trait.

ยงSafety

The JSON must be valid and well-formed, otherwise it may return unexpected result.