On 03/21/2011 11:28 AM, Curtis Jensen wrote:
How does one create a schema for an array of records?
For example, I have a record schema for a user (name and id; see
below). I would like to serialize an array of users. I've tried
various combinations of things, and I'm not getting it to work.
Thanks,
Curtis
[
{
"name": "User",
"type": "record",
"fields": [
{"name": "name", "type": "string"},
{"name": "id", "type": "int"}]
},
{
"type": "array", "items": "User"
}
]}
We do it like so:
"name": "AttributeMappings",
"type": {
"type": "array",
"items": {
"name": "AttributeMapping",
"type": "record",
"fields" : [
{"name": "Key", "type": "long"},
{"name": "Value", "type": "long"}
]
}
}
HTH,
DR