logoalt Hacker News

catchmeifyoucanyesterday at 7:41 PM2 repliesview on HN

I wonder if we can write an API w/ JSON the usual way and change the final packaging to send it over protobuf.


Replies

bglusmanyesterday at 7:55 PM

Sure... https://protobuf.dev/programming-guides/json/

I was pushing at one point for us to have some code in our protobuf parsers that would essentially allow reading messages in either JSON or binary format, though to be fair there's some overhead that way by doing some kind of try/catch, but, for some use cases I think it's worth it...

pstuartyesterday at 7:43 PM

If you're using Go then this framework let's you work with protobufs and gives you a JSON rest-like service for free: https://github.com/grpc-ecosystem/grpc-gateway