3 ms·
It has everything to do with automatic validation on both sides and little to do with the transfer size.
by arriu 4y ago
It has everything to do with automatic validation on both sides and little to do with the transfer size.
- arein3 4y agoIntroducing a binary format for payload validation is like shooting yourself in the foot because you have an itch.
- arriu 4y agoI disagree, especially if your goal is to reduce the payload size. Another point to consider is that not all programming languages deal well with JSON, adding support for it can be just as painful.
- WorldMaker 4y agoAny programming language you can teach to process protobuf or other binary formats you can teach to process JSON. The hardest part of the JSON spec is UTF-8 support and if your programming language doesn't have strong UTF-8 support in 2022 you have other, presumably larger problems.
- MrJohz 4y agoBut you can do automatic validation fairly easily with JSON Schema. You don't need to choose a binary format to get validation. The principle benefit is that you can use the schema to define the data format, which means you can pack the data in more tightly (you don't need a byte to say "this is an object" if you know that the input data must be an object at this point). That's a big benefit in certain situations, but if you're using this sort of stuff just to get validation then you're probably better off using JSON Schema and having a wire transfer format that you can read easily without additional tools.