On Mon Feb 08 22:15:16 2010, PERLER wrote:
Show quoted text> Right now DBIC::API allows two kinds of json objects
>
> {list:[{first: 'me'}]}
>
> and {first: 'me'}
>
> It would be nice if you could also add
>
> [{first: 'me'}]
>
> which would make requests like
>
>
> [{first: 'me'}, {first: 'and me'}] possible.
>
> Regards,
>
> moritz
Is there any particular reason you can't do {data:[ {first: 'me'},
{first: 'me too'} ] } ?
The single hashref syntax is really a backward compat thing. All of my
use cases actually do the proper {data: [...]} thing (and in fact,
coerce a single hashref, with or without the "data" key into an
ArrayRef[HashRef]).
Making the data explicitly available via the data_root key is a much
cleaner implementation and eventually, I'd like to do away with the raw
hashref.
If you have a compelling reason to support this other syntax, I'll
consider it, but if you really want to support it on your own, the logic
for handling all of that is inside DBIC::API/object and it is very easy
for you to override the method via Moose