You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by felix gao <gr...@gmail.com> on 2011/03/31 03:44:57 UTC
Avro Serialization help
Hi all,
I'd like to use avro as the mechanism that serialize and de-serialize data
between client and server. Since my google-jitsu is very weak, I can't
find any tutorials online teach me how to do this. Basically, I have an
object that is Map<String, List<Map<String, Object>>> in my server that
needs to be transfered to the client in Binary format and I am not sure how
to should I code that so the data will be written as bytes to be transferred
by http protocol and once the client receives it then de-serialize into java
objects again.
below is an example schema that I generated which I think maps to my java
object definition.
{
"namespace" : "test.gen.avro",
"types" : [ {
"type" : "record",
"name" : "KVPair",
"fields" : [ {
"name" : "name",
"type" : "string"
}, {
"name" : "val",
"type" : "int"
} ]
}, {
"type" : "record",
"name" : "Result",
"fields" : [ {
"name" : "res",
"type" : {
"type" : "map",
"values" : {
"type" : "array",
"items" : {
"type" : "map",
"values" : "KVPair"
}
}
}
} ]
} ]
}
thanks in advance.
Felix