Serialize a JSON value into a compact MessagePack or CBOR byte stream, returned as a base64 (default), base64url or hex string, along with the byte length.