Completely custom Json output
eelcoj opened this issue · 3 comments
eelcoj commented
Fiddled a bit with acts_as_api, but so far can't seem to get the following output:
'{"emailaddress@domain.com": {"key1":"value1", "key2":value2}, "emailaddress2@domain.com": {"key1":"value1", "key2": value2}}'
Is this even possible? Or is this out of the gem's scope?
eelcoj commented
Most of this doable, like so:
api_accessible :public do |t|
t.add :email, :as => :email
t.add :child
end
def child
{
'name' => name
}
end
No, can I remove the node "email":
here? Basically an empty :as
value?
fabrik42 commented
Hi,
sorry but you can't do this with acts_as_api. If you have the chance, you should try to change the schema of your response to deliver a reliable set of keys only with modified values.
eelcoj commented
Yeah, that's what I figured after fiddling with it some more—hoped I missed a piece somewhere. Anyway, thanks!