4 ms·
My preference is Protobuf, but really anything that's not JSON and which also comes with some IDL gets my approval.
by q3k 5y ago
My preference is Protobuf, but really anything that's not JSON and which also comes with some IDL gets my approval.
- kortex 5y agoI like protobuf for some use-casess (namely grpc) but a) it's a binary format and sometimes (often times) it's nice to have a text protocol b) protobuf libraries and protoc have given me way more grief overall than json (python, js, c++) If your workflow already supports it, I can see it being useful, but it's got a pretty steep learning curve to be honest, certainly more than json, despite the ill-implemented libs out there. If I wanted a binary format, IMHO I'd go for msgpack first, and reach for protobuf if that didn't work for me.
- elteto 5y ago> I like protobuf for some use-casess (namely grpc) but a) it's a binary format and sometimes (often times) it's nice to have a text protocol Protobuf (and flatbuffers) supports parsing messages from JSON instead of a binary blob. Best of both worlds IMO.
- avmich 5y agoCan you use JSON Schema? Generating classes from it, if you want native objects?
- q3k 5y agoYou can use whatever you want :). I personally would rather still go with Protobuf if I'm going to put in the effort to add a schema and codegen. It gives me other nice-to-have features (faster [de]serialization, smaller messages, field numbers and schema evolution, nicer IDL [not JSON!], gRPC, ...) and does away with some problems intrinsic to JSON that no schema system will fix (terrible number type, lack of binary type, slow parsing). It also has some interop with JSON in the rare case you absolutely positively need to convert to/from it (which is IMO the only upside of using JSON Schema in case you need that interop).