Function write_json
pub fn write_json<W: Write, T: Serialize>(rows: &[T], w: &mut W) -> Result<()>Expand description
Generic JSON emitter. Serialises any serde::Serialize slice as a
pretty-printed JSON array. The pretty form matches the historic
shape from the pre-shim era; downstream consumers that expect
stream-parseable single-row-per-line semantics should use
--format ndjson instead.
§Errors
Returns crate::CodeLoreError::Io when the output sink fails mid-write
(e.g. a reader closed the pipe early) and crate::CodeLoreError::Output
on a genuine serialisation fault.