Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
Avro >> mail # user >> Json tp AVRO with org.apache.avro.data


Copy link to this message
-
Json tp AVRO with org.apache.avro.data
Hi,

I read the exchange on this topic on avro-user mailing list archives: September 2012 (http://mail-archives.apache.org/mod_mbox/avro-user/201209.mbox/%[EMAIL PROTECTED]%3E)

I am sorry if that suppose to be obvious, but I still don't understand how to use the org.apache.avro.data.Json, and Json.Writer classes.
 
Particularly, how to map JSON doc. fields to AVRO schema fields.

Suppose I have a simple JSON doc:
{
"id" : "abc123",
"width" : 1.3
"details":
{
"id" : "XXX#11"
"len" : 20
}

}

Now, suppose I want AVRO schema something like:

{"namespace" : "exam",
  "type": "record",
 "name": "avro-meme",
 "fields" : [ {"name" : "id", "type ": "string"},
                   {"name" : "width", "type": "double"},
   {"name" : "details",
                        "type" : {
"type" : "record",
 "name" : "abra",
                                 "fields" : [  
{"name" : "id", "type" : "string"},
                                         {"name" : "len", "type" : "int" }
  ]
  } 
                    }
       ]
}
So how I specify json to avro mapping in org.apache.avro.data.Json , what are the rules of the game?
Or, if it is not how you suppose to use org.apache.avro.data.Json, then how?

Thank you
 Alexey
 
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB