Thalweg · API reference ← Main docs

decode_to_json

Function decode_to_json 

Source
pub fn decode_to_json(
    bytes: &[u8],
    descriptor_set: &FileDescriptorSet,
    root_type: &str,
    flatten_depth: u32,
) -> Result<Value, ProtoDecodeError>
Expand description

Decodes one protobuf-encoded message to the FLAT top-level JSON shape (matching twg-proto-schema’s derived “source” columns): lowercase, underscore-joined names up to flatten_depth, with container columns (repeated fields, or nesting beyond flatten_depth) holding fully recursively-decoded, verbatim-cased JSON.

§Errors

Returns a ProtoDecodeError if the descriptor graph cannot be flattened for the registry, or if the wire bytes fail to parse against it.