Hi,

I would like to enhance our current json rendering a little bit. The use
case is using the json output as-is with some javascript client
libraries: Currently the json output always renders an object
representation of the requested resource.

Example:
a / b with props A and B
a / c with props C and D

doing a /a.-1.json results in:
{
   "b" : { A : ... },
   "c" : { C : ... }
}

Some javascript client libs (like extjs) rather work with arrays when it
comes to collections, so in the case from above an output like
[  {A : ...}  , {C : ...}]
would be more appropriate.

Therefore I suggest we add the "list" selector to the json servlet:
/a.list.-1.json would produce the above output.
The behaviour is to create an array of the child resources of the
requested resource - the properties of the requested resource are not
rendered.

To make things a little bit more complicated, in some cases you might
want to know the original resource name (like "b" and "c" in the example
from above. And this is actually the ugly part of the proposal. I
suggest that we use a special property name returning the resource name,
like:
[  {sling:resourceName: "b", A : ...}  ,
   {sling:resourceName: "c", C : ...}]

Obviously sling:resourceName is not a good choice, so we should come up
with a more unique name.

Any ideas or comments? :)

Regards
Carsten
-- 
Carsten Ziegeler
cziege...@apache.org

Reply via email to