JSON Schema confirmation

How do I create response like following from elasticsearch-rails. I am getting response that starts with "[".

{
"data": [
{
"id": "1",
"type": "xxx",
"attributes": {
"name": "a1"
}
},
{
"id": "2",
"type": "yyy",
"attributes": {
"name": "a2"
}
},
{
"id": "3",
"type": "zzz",
"attributes": {
"name": "a3"
}
}
]
}

Hi, can you be more specific? What are you trying to do, which API you want to use?