Live data from Hacker News

It's like JSON. but fast and small.

msgpack.org

1–10 of 103 posts

Re: It's like JSON. but fast and small.

#8
This is an interesting coincidence. I happened upon this a few days ago for the first time and it worked out really wonderfully.

I needed to transfer data from a python script to a ruby script. Ended up looking like this:

Python script:

    import msgpack
    msg = msgpack.packb(some_data)
    sys.stdout.write(msg)
Ruby script:

    require 'msgpack'
    msg = `python my_script.py`
    some_data = MessagePack.unpack(msg)

Re: It's like JSON. but fast and small.

#10
This is just an implementation of a binary encoded Property Tree.

And not the best implementation out there since it lacks the redundant key/value elimination that more compact serialization formats use. Consider an array of maps where each of the maps have the same keys. By eliminating the redundant keys (have each subsequent occurrence simply reference earlier occurrences) you can halve the encoded data size relative to implementations without redundant elimination.

It also lacks a canonical string encoding. All strings are saved as raw binary data making it terrible for data interchange between environments with different string encodings.

C/C++/Objective-C users have many better options than this. In Mac/iOS/Cocoa/CoreFoundation, you can use Apple's Binary PList which is open sourced here:

    http://www.opensource.apple.com/source/CF/CF-476.10/CFBinaryPList.c
In non-Apple C/C++ environments, you can use the open source implementation of Apple's PList here:

    https://github.com/JonathanBeck/libplist
Post reply on HN