Skip to main content



This component is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with the component is found.

Performs conversions to or from a protobuf message. This processor uses reflection, meaning conversions can be made directly from the target .proto files.

# Common config fields, showing default values
label: ""
operator: to_json
message: ""
import_paths: []

The main functionality of this processor is to map to and from JSON documents, you can read more about JSON mapping of protobuf messages here:

Using reflection for processing protobuf messages in this way is less performant than generating and using native code. Therefore when performance is critical it is recommended that you use Benthos plugins instead for processing protobuf messages natively, you can find an example of Benthos plugins at



Converts protobuf messages into a generic JSON structure. This makes it easier to manipulate the contents of the document within Benthos.


Attempts to create a target protobuf message from a generic JSON structure.



The operator to execute

Type: string
Default: "to_json"
Options: to_json, from_json.


The fully qualified name of the protobuf message to convert to/from.

Type: string
Default: ""


A list of directories containing .proto files, including all definitions required for parsing the target message. If left empty the current directory is used. Each directory listed will be walked with all found .proto files imported.

Type: array
Default: []


An optional array of message indexes of a batch that the processor should apply to. If left empty all messages are processed. This field is only applicable when batching messages at the input level.

Indexes can be negative, and if so the part will be selected from the end counting backwards starting from -1.

Type: array
Default: []


If we have the following protobuf definition within a directory called testing/schema:

syntax = "proto3";
package testing;
import "google/protobuf/timestamp.proto";
message Person {
string first_name = 1;
string last_name = 2;
string full_name = 3;
int32 age = 4;
int32 id = 5; // Unique ID number for this person.
string email = 6;
google.protobuf.Timestamp last_updated = 7;

And a stream of JSON documents of the form:

"firstName": "caleb",
"lastName": "quaye",
"email": ""

We can convert the documents into protobuf messages with the following config:

- protobuf:
operator: from_json
message: testing.Person
import_paths: [ testing/schema ]