I'm trying to implement a simple JSON template, where JSON data is always returned under a 'result' node. (I have not yet attempted the layout techniques mentioned in Issues #87 & #99 - looking forward to the wiki article covering this). I may be misusing the 'node' concept of RABL.
Without the parent nodethe JSON output is correctly named (after the child object), and includes the attributes I specify. Here is that RABL & output:
object false node :error do attributes @error end child @users do attributes :name, :id, :state end
{ -error: [ null ] -users: [ -{ -user: { name: "Billy_bob" id: 853 state: "Texas" } } ...With parent node
the JSON returns the data from the users, but includes all user fields under a 'data' node :
node :error do attributes @error end node :result do child @users do attributes :name, :id, :state end end
{ -error: [ null ] -result: [ -{ -data: [ -{ bearing: 225 country: "USA" county: null created_at: "2011-08-16T02:49:32Z" description: null distance: 17.20354345468381 id: 853 name: "Billy_bob" state: "Texas" updated_at: "2011-08-16T02:49:32Z" } -{
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4