Skip to main content

array_len

Function array_len 

Source
pub fn array_len(json: &[u8], path: &[PathSegment<'_>]) -> Result<usize, Error>
Expand description

Returns the number of elements in the array located at the specified path.

§Examples

use jshift::{array_len, parse_path};

let json = b"{\"list\": [1, 2, 3]}";
assert_eq!(array_len(json, &parse_path("list")).unwrap(), 3);