Protocol Buffers data-format conversion utility.
This supports:
pbconv from-proto
: Convert JSON or Protocol Buffers Text-format into binary of Protocol Buffers wire formatpbconv to-proto
: Convert binary of Protocol Buffers wire format into JSON or Text-format
$ go install github.com/thara/pbconv@latest
sample proto file
syntax = "proto3";
package dev.thara.book;
message Book {
int64 isbn = 1;
string title = 2;
string author = 3;
bool published = 4;
}
$ cat book.json
{
"isbn": 123,
"title": "sample",
"author": "Tom",
"published": true
}
$ cat book.json | pbconv to-proto --from json --out book.bin Book book.proto
Show contents of Protocol Buffers wire format by Text-format
$ pbconv from-proto --in book.bin --to text Book book.proto
isbn: 123
title: "sample"
author: "Tom"
published: true
Tomochika Hara https://thara.dev
MIT