Quantcast
Channel: Question and Answer » json
Viewing all articles
Browse latest Browse all 148

Is it rational to convert protobuf into json to send it to a web server?

$
0
0

Protobuf is a good thing, it allows c++ devs to not bother with class serialization/deserialization, is fast and .proto format is very nice. It also allows automatic data validation. But the messages are not human readable, and most importantly not human craftable. Which is a problem when you need to quickly test the response to a certain stimuli from a remote server.

The solution, as it seems to me, is to craft protobuf message, convert it to json via some library and send this, using the same library to deserialize it to protobuf on the server and back to c++.

It seems like we get best of both words: message validation, automatic class generation from .proto files and readability of json. Sure it is slower, but for my task speed is not essential. Still, is it sane? Admittedly, I have little knowledge of networking and problems that can arise from described approach. Can someone tell me if there are future problems?


Viewing all articles
Browse latest Browse all 148

Trending Articles