Skip to main content

render_json

Function render_json 

Source
pub fn render_json<R: Serialize>(rows: &[R]) -> Result<String, RenderError>
Expand description

Render rows as a pretty-printed JSON array (one element per row, two-space indent, trailing newline).

ยงErrors

RenderError::Json when any row fails to serialise: a map key that is not string-like (a tuple, say), or a Serialize impl that returns an error. Non-finite floats serialise as null and integer keys are stringified, so neither fails. The payload is a stringified serde_json::Error.