Skip to content
/ pbconv Public

Protocol Buffers data-format conversion utility

License

Notifications You must be signed in to change notification settings

thara/pbconv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pbconv

Protocol Buffers data-format conversion utility.

This supports:

  • pbconv from-proto : Convert JSON or Protocol Buffers Text-format into binary of Protocol Buffers wire format
  • pbconv to-proto : Convert binary of Protocol Buffers wire format into JSON or Text-format

Installation

$ go install github.com/thara/pbconv@latest

Example

sample proto file

syntax = "proto3";

package dev.thara.book;

message Book {
    int64 isbn = 1;
    string title = 2;
    string author = 3;
    bool published = 4;
}

Generate binary of Protocol Buffers wire format from JSON

$ 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

Author

Tomochika Hara https://thara.dev

License

MIT

About

Protocol Buffers data-format conversion utility

Topics

Resources

License

Stars

Watchers

Forks

Languages