解決策が見つからなかったので、ここで質問することにしました。私はこの配列を持っています(必要に応じて構造を変更できます):
[[{:time=>2014, :amount=>148.24018480434023}, {:time=>2015, :amount=>152.5625744766238}], [{:time=>2014, :amount=>151.06717076828187}, {:time=>2015, :amount=>158.43869963240266}]]
Rabl テンプレートには次のものがあります。
collection @array, object_root: false
node :collection do |s|
s
end
そして、応答は次のとおりです。
[{"collection": [{"time": 2014,"amount": 148.24018480434023},{"time": 2015,"amount": 152.5625744766238}]},{"collection": [{"time": 2014,"amount": 151.06717076828187},{"time": 2015,"amount": 158.43869963240266}]}]
ただし、「コレクション」ノードを取り除き、まさにこの応答を得たいと思います。
[ [{ time: 2014, amount: 138.92 }, { time: 2015, amount: 142.98 }], [{ time: 2014, amount: 141.57 }, { time: 2015, amount: 148.48 }] ]