This is a short example showing the use of Avro, a data serialization format, based on JSON.
The schema is stored in the payload along with the data. This means we turn a Ruby Hash in to JSON and when deseriaized back to a Hash we get back the same value types as where in the original Hash. Unlike with the Ruby Marshall format the same can happen in other languages too.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
Avro is a binary format.
buffer can be any IO object, e.g. a file.
1 2 3 4 5 6 7
input is the same as
result in the previous code segment.
You will get back a correctly typed Ruby Array of Hash.
If you want to work with Avro from the command line there is
avro-tools, which is installable with
Check out this page for some examples.