Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's not a new format, I have no idea why it's popular news today. Having worked extensively with both msgpack and JSON in a javascript environment, I can tell you, its the closest to JSON of all the binary formats. The difference with JSON is msgpack's strings are binary safe (you can have a png as your value) and the format is a bit more compact, especially around integers.

JSON has: numbers, strings, booleans, null, arrays, objects. Msgpack has: numbers, raws, booleans, nil, arrays, maps.

So I guess msgpack is a superset of JSON. The raws can contain utf8 encoded strings like JSON mandates, or they can contain other things. There is no technical reason that the keys of the maps have to be strings. You could take a lua table that has another table as key and encode that in msgpack just fine.

In practice, I wanted more out of msgpack, so I extended the format using some of the reserved byte ranges to add in an "undefined" type and a distinction between utf8 encoded string and raw binary buffer.

For me this new format has been extremely useful as a general data serialization between processes (node to node, server to browser, etc..) I usually use it over binary websockets or raw tcp sockets.



Thanks for the explanation. How do you think msgpack compares to something like this: https://github.com/unixpickle/keyedbits (specification found in wiki)


Interesting format. It appears easier to implement than msgpack in a scripting language. My gut feeling is that mspack will be slightly more compact and faster to decode (especially if decoded using C).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: