You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by nanda <ga...@gmail.com> on 2011/12/05 12:43:32 UTC

Records inside records

Hi,

Is it possible to generate following kind of data object:

{
'type' : 'record',
'name': 'TYPE_A',
'fields' : [
	   {'name': 'one', 'type': {'type': 'record', 'name': 'TYPE_B',
'fields' : [ {'name' : 'inside_one',
						  'type' : 'string}
						]
				   }}
	  ]
}

----------------------------------------------------------------------------------------------------
Basically my requirement is to send timely updates from server to
clients(in various language), which might look something like(Dynamic
Map):

{'field_1' : value_1_type_int,
 'field_2' : value_2_type_string,
 'field_3' : {'field_4' : value_4_long, 'field_5' : {another map..}}
}
Why I am inclined to use avro is because I never know in advance what is
the message structure of an update going to be, it can be any number of
fields with any amount of nestedness. 
'Record' seems to be a viable option here, but not sure how I can use
nested structure here.
Could someone please help here.

Thanks,
Gaurav Nanda