3 ms·
One topic not brought up in this is versioning/change management. While I have my criticisms of Json, if I decide to add a new field to my object, most JSON par
by mabbo 8y ago
One topic not brought up in this is versioning/change management. While I have my criticisms of Json, if I decide to add a new field to my object, most JSON parsers have the advantage that they'll just consider my old data without that field to have a full value there. XML, same thing.
How does protobuf or MsgPack handle that? Aren't they both trying to align data by byte number at some deep level? Or do I not understand them?
- neuland 8y agoProtobuf has supported this for as long as I’ve used it. You add an optional field for the new data. And there’s a couple other considerations. (Docs: [0]) Fields have a number, which you can/should mark as reserved after you take it out. Then future developers won’t use a field that was something else in the past. [1] Since version all fields are optional ( they removed the required field feature). So your app has to check that the fields you want (in that version of your app) are present. [0] https://developers.google.com/protocol-buffers/docs/proto3#updating https://developers.google.com/protocol-buffers/docs/proto3#u...
- repsilat 8y agoFrom memory msgpack is semantically very similar to JSON. It unpacks into arrays and strings and hash tables in more or less the same way, though I think hash table keys are more flexible. It does not come with a schema for object structure or anything, the unpack routines are generic (and pretty "branchy" as a result.)
- blattimwind 8y agomsgpack & Co. are basically JSON-as-TLV (type-length-value) using a variable-length integer encoding for every integer.