pub fn render_json<W>(document: &Document, stream: W) -> Result<(), Error>where W: Write,
Render a document tree as JSON.
Returns an error if serialization fails.