pub fn json_to_buf<B, T>(val: &T) -> Result<B, Error>where B: Default + BufMut, T: Serialize,
Creates a buffer and writes a serializable value to it.