pub fn read_json<P: AsRef<Path>>(path: P) -> Result<Vec<Value>>Expand description
Reads a single JSON document and returns it wrapped in a one-element Vec.
The wrapping keeps the return type identical to read_jsonl so callers
can treat both file shapes uniformly. Whatever top-level JSON the file
contains (object, array, scalar) becomes the sole element.
ยงErrors
Returns an error if the file cannot be opened, if it cannot be read to a string, or if its contents are not valid JSON.